path
stringlengths 12
84
| imports
sequencelengths 0
4.45k
| premises
listlengths 0
625
|
---|---|---|
.lake/packages/lean4/src/lean/Init/Prelude.lean | [] | [
{
"full_name": "id",
"code": "@[inline] def id {α : Sort u} (a : α) : α := a",
"start": [
21,
1
],
"end": [
33,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Function.comp",
"code": "@[inline] def Function.comp {α : Sort u} {β : Sort v} {δ : Sort w} (f : β → δ) (g : α → β) : α → δ :=\n fun x => f (g x)",
"start": [
35,
1
],
"end": [
53,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Function.const",
"code": "@[inline] def Function.const {α : Sort u} (β : Sort v) (a : α) : β → α :=\n fun _ => a",
"start": [
55,
1
],
"end": [
67,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "letFun",
"code": "@[irreducible] def letFun {α : Sort u} {β : α → Sort v} (v : α) (f : (x : α) → β x) : β v := f v",
"start": [
69,
1
],
"end": [
80,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "inferInstance",
"code": "abbrev inferInstance {α : Sort u} [i : α] : α := i",
"start": [
83,
1
],
"end": [
99,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "inferInstanceAs",
"code": "abbrev inferInstanceAs (α : Sort u) [i : α] : α := i",
"start": [
102,
1
],
"end": [
113,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "PUnit",
"code": "inductive PUnit : Sort u where\n \n | unit : PUnit",
"start": [
116,
1
],
"end": [
124,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Unit",
"code": "abbrev Unit : Type := PUnit",
"start": [
126,
1
],
"end": [
142,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Unit.unit",
"code": "@[match_pattern] abbrev Unit.unit : Unit := PUnit.unit",
"start": [
144,
1
],
"end": [
148,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "lcErased",
"code": "unsafe axiom lcErased : Type",
"start": [
150,
1
],
"end": [
151,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "lcProof",
"code": "unsafe axiom lcProof {α : Prop} : α",
"start": [
153,
1
],
"end": [
162,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "lcCast",
"code": "unsafe axiom lcCast {α : Sort u} {β : Sort v} (a : α) : β",
"start": [
164,
1
],
"end": [
167,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "lcUnreachable",
"code": "unsafe axiom lcUnreachable {α : Sort u} : α",
"start": [
170,
1
],
"end": [
182,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "True",
"code": "inductive True : Prop where\n \n | intro : True",
"start": [
184,
1
],
"end": [
192,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "False",
"code": "inductive False : Prop",
"start": [
194,
1
],
"end": [
202,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Empty",
"code": "inductive Empty : Type",
"start": [
204,
1
],
"end": [
208,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "PEmpty",
"code": "inductive PEmpty : Sort u where",
"start": [
211,
1
],
"end": [
215,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Not",
"code": "def Not (a : Prop) : Prop := a → False",
"start": [
217,
1
],
"end": [
224,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "False.elim",
"code": "@[macro_inline] def False.elim {C : Sort u} (h : False) : C :=\n h.rec",
"start": [
226,
1
],
"end": [
237,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "absurd",
"code": "@[macro_inline] def absurd {a : Prop} {b : Sort v} (h₁ : a) (h₂ : Not a) : b :=\n (h₂ h₁).rec",
"start": [
239,
1
],
"end": [
247,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq",
"code": "inductive Eq : α → α → Prop where\n \n | refl (a : α) : Eq a a",
"start": [
249,
1
],
"end": [
279,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.ndrec",
"code": "@[simp] abbrev Eq.ndrec.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} (m : motive a) {b : α} (h : Eq a b) : motive b :=\n h.rec m",
"start": [
281,
1
],
"end": [
283,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "rfl",
"code": "@[match_pattern] def rfl {α : Sort u} {a : α} : Eq a a := Eq.refl a",
"start": [
285,
1
],
"end": [
294,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "id_eq",
"code": "@[simp] theorem id_eq (a : α) : Eq (id a) a",
"start": [
296,
1
],
"end": [
297,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.subst",
"code": "theorem Eq.subst {α : Sort u} {motive : α → Prop} {a b : α} (h₁ : Eq a b) (h₂ : motive a) : motive b",
"start": [
299,
1
],
"end": [
313,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.symm",
"code": "theorem Eq.symm {α : Sort u} {a b : α} (h : Eq a b) : Eq b a",
"start": [
315,
1
],
"end": [
324,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.trans",
"code": "theorem Eq.trans {α : Sort u} {a b c : α} (h₁ : Eq a b) (h₂ : Eq b c) : Eq a c",
"start": [
326,
1
],
"end": [
336,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "cast",
"code": "@[macro_inline] def cast {α β : Sort u} (h : Eq α β) (a : α) : β :=\n h.rec a",
"start": [
338,
1
],
"end": [
350,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "congrArg",
"code": "theorem congrArg {α : Sort u} {β : Sort v} {a₁ a₂ : α} (f : α → β) (h : Eq a₁ a₂) : Eq (f a₁) (f a₂)",
"start": [
352,
1
],
"end": [
363,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "congr",
"code": "theorem congr {α : Sort u} {β : Sort v} {f₁ f₂ : α → β} {a₁ a₂ : α} (h₁ : Eq f₁ f₂) (h₂ : Eq a₁ a₂) : Eq (f₁ a₁) (f₂ a₂)",
"start": [
365,
1
],
"end": [
373,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "congrFun",
"code": "theorem congrFun {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x} (h : Eq f g) (a : α) : Eq (f a) (g a)",
"start": [
375,
1
],
"end": [
377,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.lcInv",
"code": "unsafe axiom Quot.lcInv {α : Sort u} {r : α → α → Prop} (q : Quot r) : α",
"start": [
439,
1
],
"end": [
442,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq",
"code": "inductive HEq : {α : Sort u} → α → {β : Sort u} → β → Prop where\n \n | refl (a : α) : HEq a a",
"start": [
444,
1
],
"end": [
458,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.rfl",
"code": "@[match_pattern] protected def HEq.rfl {α : Sort u} {a : α} : HEq a a :=\n HEq.refl a",
"start": [
460,
1
],
"end": [
462,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_of_heq",
"code": "theorem eq_of_heq {α : Sort u} {a a' : α} (h : HEq a a') : Eq a a'",
"start": [
464,
1
],
"end": [
468,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod",
"code": "structure Prod (α : Type u) (β : Type v) where\n \n mk ::\n \n fst : α\n \n snd : β",
"start": [
470,
1
],
"end": [
485,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "PProd",
"code": "@[pp_using_anonymous_constructor]\nstructure PProd (α : Sort u) (β : Sort v) where\n \n fst : α\n \n snd : β",
"start": [
489,
1
],
"end": [
498,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "MProd",
"code": "structure MProd (α β : Type u) where\n \n fst : α\n \n snd : β",
"start": [
500,
1
],
"end": [
508,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "And",
"code": "@[pp_using_anonymous_constructor]\nstructure And (a b : Prop) : Prop where\n \n intro ::\n \n left : a\n \n right : b",
"start": [
510,
1
],
"end": [
524,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Or",
"code": "inductive Or (a b : Prop) : Prop where\n \n | inl (h : a) : Or a b\n \n | inr (h : b) : Or a b",
"start": [
526,
1
],
"end": [
536,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.intro_left",
"code": "theorem Or.intro_left (b : Prop) (h : a) : Or a b",
"start": [
538,
1
],
"end": [
540,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.intro_right",
"code": "theorem Or.intro_right (a : Prop) (h : b) : Or a b",
"start": [
542,
1
],
"end": [
544,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.elim",
"code": "theorem Or.elim {c : Prop} (h : Or a b) (left : a → c) (right : b → c) : c",
"start": [
546,
1
],
"end": [
553,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.resolve_left",
"code": "theorem Or.resolve_left (h: Or a b) (na : Not a) : b",
"start": [
555,
1
],
"end": [
555,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.resolve_right",
"code": "theorem Or.resolve_right (h: Or a b) (nb : Not b) : a",
"start": [
556,
1
],
"end": [
556,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.neg_resolve_left",
"code": "theorem Or.neg_resolve_left (h : Or (Not a) b) (ha : a) : b",
"start": [
557,
1
],
"end": [
557,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.neg_resolve_right",
"code": "theorem Or.neg_resolve_right (h : Or a (Not b)) (nb : b) : a",
"start": [
558,
1
],
"end": [
558,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool",
"code": "inductive Bool : Type where\n \n | false : Bool\n \n | true : Bool",
"start": [
560,
1
],
"end": [
571,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Subtype",
"code": "@[pp_using_anonymous_constructor]\nstructure Subtype {α : Sort u} (p : α → Prop) where\n \n val : α\n \n property : p val",
"start": [
575,
1
],
"end": [
590,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "optParam",
"code": "@[reducible] def optParam (α : Sort u) (default : α) : Sort u := α",
"start": [
593,
1
],
"end": [
600,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "outParam",
"code": "@[reducible] def outParam (α : Sort u) : Sort u := α",
"start": [
602,
1
],
"end": [
618,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "semiOutParam",
"code": "@[reducible] def semiOutParam (α : Sort u) : Sort u := α",
"start": [
620,
1
],
"end": [
641,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "namedPattern",
"code": "@[reducible] def namedPattern {α : Sort u} (x a : α) (h : Eq x a) : α := a",
"start": [
644,
1
],
"end": [
645,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "sorryAx",
"code": "@[extern \"lean_sorry\", never_extract]\naxiom sorryAx (α : Sort u) (synthetic := false) : α",
"start": [
647,
1
],
"end": [
664,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_false_of_ne_true",
"code": "theorem eq_false_of_ne_true : {b : Bool} → Not (Eq b true) → Eq b false",
"start": [
666,
1
],
"end": [
668,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_true_of_ne_false",
"code": "theorem eq_true_of_ne_false : {b : Bool} → Not (Eq b false) → Eq b true",
"start": [
670,
1
],
"end": [
672,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_false_of_eq_true",
"code": "theorem ne_false_of_eq_true : {b : Bool} → Eq b true → Not (Eq b false)",
"start": [
674,
1
],
"end": [
676,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_true_of_eq_false",
"code": "theorem ne_true_of_eq_false : {b : Bool} → Eq b false → Not (Eq b true)",
"start": [
678,
1
],
"end": [
680,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Inhabited",
"code": "class Inhabited (α : Sort u) where\n \n default : α",
"start": [
682,
1
],
"end": [
697,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nonempty",
"code": "class inductive Nonempty (α : Sort u) : Prop where\n \n | intro (val : α) : Nonempty α",
"start": [
701,
1
],
"end": [
711,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.choice",
"code": "axiom Classical.choice {α : Sort u} : Nonempty α → α",
"start": [
713,
1
],
"end": [
735,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nonempty.elim",
"code": "protected theorem Nonempty.elim {α : Sort u} {p : Prop} (h₁ : Nonempty α) (h₂ : α → p) : p",
"start": [
737,
1
],
"end": [
745,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.ofNonempty",
"code": "noncomputable def Classical.ofNonempty {α : Sort u} [Nonempty α] : α :=\n Classical.choice inferInstance",
"start": [
750,
1
],
"end": [
755,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "PLift",
"code": "structure PLift (α : Sort u) : Type u where\n up ::\n down : α",
"start": [
774,
1
],
"end": [
777,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "PLift.up_down",
"code": "theorem PLift.up_down {α : Sort u} (b : PLift α) : Eq (up (down b)) b",
"start": [
779,
1
],
"end": [
780,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "PLift.down_up",
"code": "theorem PLift.down_up {α : Sort u} (a : α) : Eq (down (up a)) a",
"start": [
782,
1
],
"end": [
783,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "NonemptyType",
"code": "def NonemptyType := Subtype fun α : Type u => Nonempty α",
"start": [
785,
1
],
"end": [
791,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "NonemptyType.type",
"code": "abbrev NonemptyType.type (type : NonemptyType.{u}) : Type u :=\n type.val",
"start": [
793,
1
],
"end": [
795,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "ULift",
"code": "structure ULift.{r, s} (α : Type s) : Type (max s r) where\n up ::\n down : α",
"start": [
801,
1
],
"end": [
811,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "ULift.up_down",
"code": "theorem ULift.up_down {α : Type u} (b : ULift.{v} α) : Eq (up (down b)) b",
"start": [
813,
1
],
"end": [
814,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "ULift.down_up",
"code": "theorem ULift.down_up {α : Type u} (a : α) : Eq (down (up.{v} a)) a",
"start": [
816,
1
],
"end": [
817,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable",
"code": "class inductive Decidable (p : Prop) where\n \n | isFalse (h : Not p) : Decidable p\n \n | isTrue (h : p) : Decidable p",
"start": [
819,
1
],
"end": [
843,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.decide",
"code": "@[inline_if_reduce, nospecialize] def Decidable.decide (p : Prop) [h : Decidable p] : Bool :=\n h.casesOn (fun _ => false) (fun _ => true)",
"start": [
845,
1
],
"end": [
852,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "DecidablePred",
"code": "abbrev DecidablePred {α : Sort u} (r : α → Prop) :=\n (a : α) → Decidable (r a)",
"start": [
856,
1
],
"end": [
858,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "DecidableRel",
"code": "abbrev DecidableRel {α : Sort u} (r : α → α → Prop) :=\n (a b : α) → Decidable (r a b)",
"start": [
860,
1
],
"end": [
862,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "DecidableEq",
"code": "abbrev DecidableEq (α : Sort u) :=\n (a b : α) → Decidable (Eq a b)",
"start": [
864,
1
],
"end": [
869,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "decEq",
"code": "def decEq {α : Sort u} [inst : DecidableEq α] (a b : α) : Decidable (Eq a b) :=\n inst a b",
"start": [
871,
1
],
"end": [
873,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_true",
"code": "theorem decide_eq_true : [inst : Decidable p] → p → Eq (decide p) true",
"start": [
876,
1
],
"end": [
878,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_false",
"code": "theorem decide_eq_false : [Decidable p] → Not p → Eq (decide p) false",
"start": [
880,
1
],
"end": [
882,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "of_decide_eq_true",
"code": "theorem of_decide_eq_true [inst : Decidable p] : Eq (decide p) true → p",
"start": [
884,
1
],
"end": [
887,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "of_decide_eq_false",
"code": "theorem of_decide_eq_false [inst : Decidable p] : Eq (decide p) false → Not p",
"start": [
889,
1
],
"end": [
892,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "of_decide_eq_self_eq_true",
"code": "theorem of_decide_eq_self_eq_true [inst : DecidableEq α] (a : α) : Eq (decide (Eq a a)) true",
"start": [
894,
1
],
"end": [
897,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decEq",
"code": "@[inline] def Bool.decEq (a b : Bool) : Decidable (Eq a b) :=\n match a, b with\n | false, false => isTrue rfl\n | false, true => isFalse (fun h => Bool.noConfusion h)\n | true, false => isFalse (fun h => Bool.noConfusion h)\n | true, true => isTrue rfl",
"start": [
899,
1
],
"end": [
905,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "BEq",
"code": "class BEq (α : Type u) where\n \n beq : α → α → Bool",
"start": [
910,
1
],
"end": [
923,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "dite",
"code": "@[macro_inline] def dite {α : Sort u} (c : Prop) [h : Decidable c] (t : c → α) (e : Not c → α) : α :=\n h.casesOn e t",
"start": [
931,
1
],
"end": [
946,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "ite",
"code": "@[macro_inline] def ite {α : Sort u} (c : Prop) [h : Decidable c] (t e : α) : α :=\n h.casesOn (fun _ => e) (fun _ => t)",
"start": [
950,
1
],
"end": [
971,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "cond",
"code": "@[macro_inline] def cond {α : Type u} (c : Bool) (x y : α) : α :=\n match c with\n | true => x\n | false => y",
"start": [
1000,
1
],
"end": [
1009,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "or",
"code": "@[macro_inline] def or (x y : Bool) : Bool :=\n match x with\n | true => true\n | false => y",
"start": [
1011,
1
],
"end": [
1020,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "and",
"code": "@[macro_inline] def and (x y : Bool) : Bool :=\n match x with\n | false => false\n | true => y",
"start": [
1022,
1
],
"end": [
1031,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "not",
"code": "@[inline] def not : Bool → Bool\n | true => false\n | false => true",
"start": [
1033,
1
],
"end": [
1039,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat",
"code": "inductive Nat where\n \n | zero : Nat\n \n | succ (n : Nat) : Nat",
"start": [
1041,
1
],
"end": [
1083,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "OfNat",
"code": "class OfNat (α : Type u) (_ : Nat) where\n \n ofNat : α",
"start": [
1088,
1
],
"end": [
1105,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "instOfNatNat",
"code": "@[default_instance 100] \ninstance instOfNatNat (n : Nat) : OfNat Nat n where\n ofNat := n",
"start": [
1107,
1
],
"end": [
1109,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "LE",
"code": "class LE (α : Type u) where\n \n le : α → α → Prop",
"start": [
1111,
1
],
"end": [
1114,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "LT",
"code": "class LT (α : Type u) where\n \n lt : α → α → Prop",
"start": [
1116,
1
],
"end": [
1119,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "GE.ge",
"code": "@[reducible] def GE.ge {α : Type u} [LE α] (a b : α) : Prop := LE.le b a",
"start": [
1121,
1
],
"end": [
1122,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "GT.gt",
"code": "@[reducible] def GT.gt {α : Type u} [LT α] (a b : α) : Prop := LT.lt b a",
"start": [
1123,
1
],
"end": [
1124,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Max",
"code": "class Max (α : Type u) where\n \n max : α → α → α",
"start": [
1126,
1
],
"end": [
1129,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "maxOfLe",
"code": "@[inline]\ndef maxOfLe [LE α] [DecidableRel (@LE.le α _)] : Max α where\n max x y := ite (LE.le x y) y x",
"start": [
1133,
1
],
"end": [
1137,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Min",
"code": "class Min (α : Type u) where\n \n min : α → α → α",
"start": [
1139,
1
],
"end": [
1142,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "minOfLe",
"code": "@[inline]\ndef minOfLe [LE α] [DecidableRel (@LE.le α _)] : Min α where\n min x y := ite (LE.le x y) x y",
"start": [
1146,
1
],
"end": [
1150,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Trans",
"code": "class Trans (r : α → β → Sort u) (s : β → γ → Sort v) (t : outParam (α → γ → Sort w)) where\n \n trans : r a b → s b c → t a c",
"start": [
1152,
1
],
"end": [
1163,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "HAdd",
"code": "class HAdd (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hAdd : α → β → γ",
"start": [
1173,
1
],
"end": [
1180,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HSub",
"code": "class HSub (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hSub : α → β → γ",
"start": [
1182,
1
],
"end": [
1190,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HMul",
"code": "class HMul (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hMul : α → β → γ",
"start": [
1192,
1
],
"end": [
1199,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HDiv",
"code": "class HDiv (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hDiv : α → β → γ",
"start": [
1201,
1
],
"end": [
1217,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HMod",
"code": "class HMod (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hMod : α → β → γ",
"start": [
1219,
1
],
"end": [
1228,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HPow",
"code": "class HPow (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hPow : α → β → γ",
"start": [
1230,
1
],
"end": [
1237,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HAppend",
"code": "class HAppend (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hAppend : α → β → γ",
"start": [
1239,
1
],
"end": [
1246,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "HOrElse",
"code": "class HOrElse (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hOrElse : α → (Unit → β) → γ",
"start": [
1248,
1
],
"end": [
1258,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "HAndThen",
"code": "class HAndThen (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hAndThen : α → (Unit → β) → γ",
"start": [
1260,
1
],
"end": [
1270,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "HAnd",
"code": "class HAnd (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hAnd : α → β → γ",
"start": [
1272,
1
],
"end": [
1276,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HXor",
"code": "class HXor (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hXor : α → β → γ",
"start": [
1278,
1
],
"end": [
1282,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "HOr",
"code": "class HOr (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hOr : α → β → γ",
"start": [
1284,
1
],
"end": [
1288,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "HShiftLeft",
"code": "class HShiftLeft (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hShiftLeft : α → β → γ",
"start": [
1290,
1
],
"end": [
1297,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "HShiftRight",
"code": "class HShiftRight (α : Type u) (β : Type v) (γ : outParam (Type w)) where\n \n hShiftRight : α → β → γ",
"start": [
1299,
1
],
"end": [
1305,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Add",
"code": "class Add (α : Type u) where\n \n add : α → α → α",
"start": [
1307,
1
],
"end": [
1310,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Sub",
"code": "class Sub (α : Type u) where\n \n sub : α → α → α",
"start": [
1312,
1
],
"end": [
1315,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Mul",
"code": "class Mul (α : Type u) where\n \n mul : α → α → α",
"start": [
1317,
1
],
"end": [
1320,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Neg",
"code": "class Neg (α : Type u) where\n \n neg : α → α",
"start": [
1322,
1
],
"end": [
1329,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Div",
"code": "class Div (α : Type u) where\n \n div : α → α → α",
"start": [
1331,
1
],
"end": [
1334,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Mod",
"code": "class Mod (α : Type u) where\n \n mod : α → α → α",
"start": [
1336,
1
],
"end": [
1339,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Dvd",
"code": "class Dvd (α : Type _) where\n \n dvd : α → α → Prop",
"start": [
1341,
1
],
"end": [
1344,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Pow",
"code": "class Pow (α : Type u) (β : Type v) where\n \n pow : α → β → α",
"start": [
1346,
1
],
"end": [
1358,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "NatPow",
"code": "class NatPow (α : Type u) where\n \n protected pow : α → Nat → α",
"start": [
1360,
1
],
"end": [
1368,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "HomogeneousPow",
"code": "class HomogeneousPow (α : Type u) where\n \n protected pow : α → α → α",
"start": [
1370,
1
],
"end": [
1380,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Append",
"code": "class Append (α : Type u) where\n \n append : α → α → α",
"start": [
1382,
1
],
"end": [
1385,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "OrElse",
"code": "class OrElse (α : Type u) where\n \n orElse : α → (Unit → α) → α",
"start": [
1387,
1
],
"end": [
1394,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "AndThen",
"code": "class AndThen (α : Type u) where\n \n andThen : α → (Unit → α) → α",
"start": [
1396,
1
],
"end": [
1403,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "AndOp",
"code": "class AndOp (α : Type u) where\n \n and : α → α → α",
"start": [
1405,
1
],
"end": [
1411,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Xor",
"code": "class Xor (α : Type u) where\n \n xor : α → α → α",
"start": [
1413,
1
],
"end": [
1416,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "OrOp",
"code": "class OrOp (α : Type u) where\n \n or : α → α → α",
"start": [
1418,
1
],
"end": [
1424,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Complement",
"code": "class Complement (α : Type u) where\n \n complement : α → α",
"start": [
1426,
1
],
"end": [
1429,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "ShiftLeft",
"code": "class ShiftLeft (α : Type u) where\n \n shiftLeft : α → α → α",
"start": [
1431,
1
],
"end": [
1434,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "ShiftRight",
"code": "class ShiftRight (α : Type u) where\n \n shiftRight : α → α → α",
"start": [
1436,
1
],
"end": [
1439,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "instHAdd",
"code": "@[default_instance]\ninstance instHAdd [Add α] : HAdd α α α where\n hAdd a b := Add.add a b",
"start": [
1441,
1
],
"end": [
1443,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instHSub",
"code": "@[default_instance]\ninstance instHSub [Sub α] : HSub α α α where\n hSub a b := Sub.sub a b",
"start": [
1445,
1
],
"end": [
1447,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instHMul",
"code": "@[default_instance]\ninstance instHMul [Mul α] : HMul α α α where\n hMul a b := Mul.mul a b",
"start": [
1449,
1
],
"end": [
1451,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instHDiv",
"code": "@[default_instance]\ninstance instHDiv [Div α] : HDiv α α α where\n hDiv a b := Div.div a b",
"start": [
1453,
1
],
"end": [
1455,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instHMod",
"code": "@[default_instance]\ninstance instHMod [Mod α] : HMod α α α where\n hMod a b := Mod.mod a b",
"start": [
1457,
1
],
"end": [
1459,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instHPow",
"code": "@[default_instance]\ninstance instHPow [Pow α β] : HPow α β α where\n hPow a b := Pow.pow a b",
"start": [
1461,
1
],
"end": [
1463,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "instPowNat",
"code": "@[default_instance]\ninstance instPowNat [NatPow α] : Pow α Nat where\n pow a n := NatPow.pow a n",
"start": [
1465,
1
],
"end": [
1467,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Membership",
"code": "class Membership (α : outParam (Type u)) (γ : Type v) where\n \n mem : α → γ → Prop",
"start": [
1511,
1
],
"end": [
1518,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add",
"code": "@[extern \"lean_nat_add\"]\nprotected def Nat.add : (@& Nat) → (@& Nat) → Nat\n | a, Nat.zero => a\n | a, Nat.succ b => Nat.succ (Nat.add a b)",
"start": [
1521,
1
],
"end": [
1531,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "instAddNat",
"code": "instance instAddNat : Add Nat where\n add := Nat.add",
"start": [
1533,
1
],
"end": [
1534,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul",
"code": "@[extern \"lean_nat_mul\"]\nprotected def Nat.mul : (@& Nat) → (@& Nat) → Nat\n | _, 0 => 0\n | a, Nat.succ b => Nat.add (Nat.mul a b) a",
"start": [
1541,
1
],
"end": [
1551,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "instMulNat",
"code": "instance instMulNat : Mul Nat where\n mul := Nat.mul",
"start": [
1553,
1
],
"end": [
1554,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow",
"code": "@[extern \"lean_nat_pow\"]\nprotected def Nat.pow (m : @& Nat) : (@& Nat) → Nat\n | 0 => 1\n | succ n => Nat.mul (Nat.pow m n) m",
"start": [
1557,
1
],
"end": [
1567,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "instNatPowNat",
"code": "instance instNatPowNat : NatPow Nat := ⟨Nat.pow⟩",
"start": [
1569,
1
],
"end": [
1569,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.beq",
"code": "@[extern \"lean_nat_dec_eq\"]\ndef Nat.beq : (@& Nat) → (@& Nat) → Bool\n | zero, zero => true\n | zero, succ _ => false\n | succ _, zero => false\n | succ n, succ m => beq n m",
"start": [
1572,
1
],
"end": [
1584,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_of_beq_eq_true",
"code": "theorem Nat.eq_of_beq_eq_true : {n m : Nat} → Eq (beq n m) true → Eq n m",
"start": [
1589,
1
],
"end": [
1596,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_of_beq_eq_false",
"code": "theorem Nat.ne_of_beq_eq_false : {n m : Nat} → Eq (beq n m) false → Not (Eq n m)",
"start": [
1598,
1
],
"end": [
1604,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decEq",
"code": "@[reducible, extern \"lean_nat_dec_eq\"]\nprotected def Nat.decEq (n m : @& Nat) : Decidable (Eq n m) :=\n match h:beq n m with\n | true => isTrue (eq_of_beq_eq_true h)\n | false => isFalse (ne_of_beq_eq_false h)",
"start": [
1606,
1
],
"end": [
1617,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ble",
"code": "@[extern \"lean_nat_dec_le\"]\ndef Nat.ble : @& Nat → @& Nat → Bool\n | zero, zero => true\n | zero, succ _ => true\n | succ _, zero => false\n | succ n, succ m => ble n m",
"start": [
1622,
1
],
"end": [
1634,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le",
"code": "protected inductive Nat.le (n : Nat) : Nat → Prop\n \n | refl : Nat.le n n\n \n | step {m} : Nat.le n m → Nat.le n (succ m)",
"start": [
1636,
1
],
"end": [
1644,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "instLENat",
"code": "instance instLENat : LE Nat where\n le := Nat.le",
"start": [
1646,
1
],
"end": [
1647,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt",
"code": "protected def Nat.lt (n m : Nat) : Prop :=\n Nat.le (succ n) m",
"start": [
1649,
1
],
"end": [
1651,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "instLTNat",
"code": "instance instLTNat : LT Nat where\n lt := Nat.lt",
"start": [
1653,
1
],
"end": [
1654,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_succ_le_zero",
"code": "theorem Nat.not_succ_le_zero : ∀ (n : Nat), LE.le (succ n) 0 → False",
"start": [
1656,
1
],
"end": [
1658,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_zero",
"code": "theorem Nat.not_lt_zero (n : Nat) : Not (LT.lt n 0)",
"start": [
1660,
1
],
"end": [
1661,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_le",
"code": "theorem Nat.zero_le : (n : Nat) → LE.le 0 n",
"start": [
1663,
1
],
"end": [
1665,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_le_succ",
"code": "theorem Nat.succ_le_succ : LE.le n m → LE.le (succ n) (succ m)",
"start": [
1667,
1
],
"end": [
1669,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_succ",
"code": "theorem Nat.zero_lt_succ (n : Nat) : LT.lt 0 (succ n)",
"start": [
1671,
1
],
"end": [
1672,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_step",
"code": "theorem Nat.le_step (h : LE.le n m) : LE.le n (succ m)",
"start": [
1674,
1
],
"end": [
1675,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_trans",
"code": "protected theorem Nat.le_trans {n m k : Nat} : LE.le n m → LE.le m k → LE.le n k",
"start": [
1677,
1
],
"end": [
1679,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_trans",
"code": "protected theorem Nat.lt_trans {n m k : Nat} (h₁ : LT.lt n m) : LT.lt m k → LT.lt n k",
"start": [
1681,
1
],
"end": [
1682,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_succ",
"code": "theorem Nat.le_succ (n : Nat) : LE.le n (succ n)",
"start": [
1684,
1
],
"end": [
1685,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_succ_of_le",
"code": "theorem Nat.le_succ_of_le {n m : Nat} (h : LE.le n m) : LE.le n (succ m)",
"start": [
1687,
1
],
"end": [
1688,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_refl",
"code": "protected theorem Nat.le_refl (n : Nat) : LE.le n n",
"start": [
1690,
1
],
"end": [
1691,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_pos",
"code": "theorem Nat.succ_pos (n : Nat) : LT.lt 0 (succ n)",
"start": [
1693,
1
],
"end": [
1694,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred",
"code": "@[extern \"lean_nat_pred\"]\ndef Nat.pred : (@& Nat) → Nat\n | 0 => 0\n | succ a => a",
"start": [
1697,
1
],
"end": [
1706,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_le_pred",
"code": "theorem Nat.pred_le_pred : {n m : Nat} → LE.le n m → LE.le (pred n) (pred m)",
"start": [
1708,
1
],
"end": [
1711,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_succ_le_succ",
"code": "theorem Nat.le_of_succ_le_succ {n m : Nat} : LE.le (succ n) (succ m) → LE.le n m",
"start": [
1713,
1
],
"end": [
1714,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_lt_succ",
"code": "theorem Nat.le_of_lt_succ {m n : Nat} : LT.lt m (succ n) → LE.le m n",
"start": [
1716,
1
],
"end": [
1717,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_or_lt_of_le",
"code": "protected theorem Nat.eq_or_lt_of_le : {n m: Nat} → LE.le n m → Or (Eq n m) (LT.lt n m)",
"start": [
1719,
1
],
"end": [
1727,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_or_ge",
"code": "protected theorem Nat.lt_or_ge (n m : Nat) : Or (LT.lt n m) (GE.ge n m)",
"start": [
1729,
1
],
"end": [
1738,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_succ_le_self",
"code": "theorem Nat.not_succ_le_self : (n : Nat) → Not (LE.le (succ n) n)",
"start": [
1740,
1
],
"end": [
1742,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_irrefl",
"code": "protected theorem Nat.lt_irrefl (n : Nat) : Not (LT.lt n n)",
"start": [
1744,
1
],
"end": [
1745,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_le_of_lt",
"code": "protected theorem Nat.lt_of_le_of_lt {n m k : Nat} (h₁ : LE.le n m) (h₂ : LT.lt m k) : LT.lt n k",
"start": [
1747,
1
],
"end": [
1748,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_antisymm",
"code": "protected theorem Nat.le_antisymm {n m : Nat} (h₁ : LE.le n m) (h₂ : LE.le m n) : Eq n m",
"start": [
1750,
1
],
"end": [
1753,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_le_of_ne",
"code": "protected theorem Nat.lt_of_le_of_ne {n m : Nat} (h₁ : LE.le n m) (h₂ : Not (Eq n m)) : LT.lt n m",
"start": [
1755,
1
],
"end": [
1758,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_ble_eq_true",
"code": "theorem Nat.le_of_ble_eq_true (h : Eq (Nat.ble n m) true) : LE.le n m",
"start": [
1760,
1
],
"end": [
1763,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ble_self_eq_true",
"code": "theorem Nat.ble_self_eq_true : (n : Nat) → Eq (Nat.ble n n) true",
"start": [
1765,
1
],
"end": [
1767,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ble_succ_eq_true",
"code": "theorem Nat.ble_succ_eq_true : {n m : Nat} → Eq (Nat.ble n m) true → Eq (Nat.ble n (succ m)) true",
"start": [
1769,
1
],
"end": [
1771,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ble_eq_true_of_le",
"code": "theorem Nat.ble_eq_true_of_le (h : LE.le n m) : Eq (Nat.ble n m) true",
"start": [
1773,
1
],
"end": [
1776,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_le_of_not_ble_eq_true",
"code": "theorem Nat.not_le_of_not_ble_eq_true (h : Not (Eq (Nat.ble n m) true)) : Not (LE.le n m)",
"start": [
1778,
1
],
"end": [
1779,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decLe",
"code": "@[extern \"lean_nat_dec_le\"]\ninstance Nat.decLe (n m : @& Nat) : Decidable (LE.le n m) :=\n dite (Eq (Nat.ble n m) true) (fun h => isTrue (Nat.le_of_ble_eq_true h)) (fun h => isFalse (Nat.not_le_of_not_ble_eq_true h))",
"start": [
1781,
1
],
"end": [
1783,
128
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decLt",
"code": "@[extern \"lean_nat_dec_lt\"]\ninstance Nat.decLt (n m : @& Nat) : Decidable (LT.lt n m) :=\n decLe (succ n) m",
"start": [
1785,
1
],
"end": [
1787,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub",
"code": "@[extern \"lean_nat_sub\"]\nprotected def Nat.sub : (@& Nat) → (@& Nat) → Nat\n | a, 0 => a\n | a, succ b => pred (Nat.sub a b)",
"start": [
1792,
1
],
"end": [
1803,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "instSubNat",
"code": "instance instSubNat : Sub Nat where\n sub := Nat.sub",
"start": [
1805,
1
],
"end": [
1806,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.getNumBits",
"code": "@[extern \"lean_system_platform_nbits\"] opaque System.Platform.getNumBits : Unit → Subtype fun (n : Nat) => Or (Eq n 32) (Eq n 64) :=\n fun _ => ⟨64, Or.inr rfl⟩",
"start": [
1808,
1
],
"end": [
1817,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.numBits",
"code": "def System.Platform.numBits : Nat :=\n (getNumBits ()).val",
"start": [
1819,
1
],
"end": [
1821,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.numBits_eq",
"code": "theorem System.Platform.numBits_eq : Or (Eq numBits 32) (Eq numBits 64)",
"start": [
1823,
1
],
"end": [
1824,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin",
"code": "@[pp_using_anonymous_constructor]\nstructure Fin (n : Nat) where\n \n mk ::\n \n val : Nat\n \n isLt : LT.lt val n",
"start": [
1826,
1
],
"end": [
1838,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eq_of_val_eq",
"code": "theorem Fin.eq_of_val_eq {n} : ∀ {i j : Fin n}, Eq i.val j.val → Eq i j",
"start": [
1842,
1
],
"end": [
1843,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_eq_of_eq",
"code": "theorem Fin.val_eq_of_eq {n} {i j : Fin n} (h : Eq i j) : Eq i.val j.val",
"start": [
1845,
1
],
"end": [
1846,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ne_of_val_ne",
"code": "theorem Fin.ne_of_val_ne {n} {i j : Fin n} (h : Not (Eq i.val j.val)) : Not (Eq i j)",
"start": [
1848,
1
],
"end": [
1849,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.decLt",
"code": "instance Fin.decLt {n} (a b : Fin n) : Decidable (LT.lt a b) := Nat.decLt ..",
"start": [
1863,
1
],
"end": [
1863,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.decLe",
"code": "instance Fin.decLe {n} (a b : Fin n) : Decidable (LE.le a b) := Nat.decLe ..",
"start": [
1864,
1
],
"end": [
1864,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.size",
"code": "abbrev UInt8.size : Nat := 256",
"start": [
1866,
1
],
"end": [
1867,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8",
"code": "structure UInt8 where\n \n val : Fin UInt8.size",
"start": [
1869,
1
],
"end": [
1876,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.ofNatCore",
"code": "@[extern \"lean_uint8_of_nat\"]\ndef UInt8.ofNatCore (n : @& Nat) (h : LT.lt n UInt8.size) : UInt8 where\n val := { val := n, isLt := h }",
"start": [
1881,
1
],
"end": [
1887,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.decEq",
"code": "@[extern \"lean_uint8_dec_eq\"]\ndef UInt8.decEq (a b : UInt8) : Decidable (Eq a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ =>\n dite (Eq n m) (fun h => isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => UInt8.noConfusion h' (fun h' => absurd h' h)))",
"start": [
1890,
1
],
"end": [
1898,
122
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.size",
"code": "abbrev UInt16.size : Nat := 65536",
"start": [
1905,
1
],
"end": [
1906,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16",
"code": "structure UInt16 where\n \n val : Fin UInt16.size",
"start": [
1908,
1
],
"end": [
1915,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.ofNatCore",
"code": "@[extern \"lean_uint16_of_nat\"]\ndef UInt16.ofNatCore (n : @& Nat) (h : LT.lt n UInt16.size) : UInt16 where\n val := { val := n, isLt := h }",
"start": [
1920,
1
],
"end": [
1926,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.decEq",
"code": "@[extern \"lean_uint16_dec_eq\"]\ndef UInt16.decEq (a b : UInt16) : Decidable (Eq a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ =>\n dite (Eq n m) (fun h => isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => UInt16.noConfusion h' (fun h' => absurd h' h)))",
"start": [
1929,
1
],
"end": [
1937,
123
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.size",
"code": "abbrev UInt32.size : Nat := 4294967296",
"start": [
1944,
1
],
"end": [
1945,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32",
"code": "structure UInt32 where\n \n val : Fin UInt32.size",
"start": [
1947,
1
],
"end": [
1954,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.ofNatCore",
"code": "@[extern \"lean_uint32_of_nat\"]\ndef UInt32.ofNatCore (n : @& Nat) (h : LT.lt n UInt32.size) : UInt32 where\n val := { val := n, isLt := h }",
"start": [
1959,
1
],
"end": [
1965,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.toNat",
"code": "@[extern \"lean_uint32_to_nat\"]\ndef UInt32.toNat (n : UInt32) : Nat := n.val.val",
"start": [
1967,
1
],
"end": [
1972,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.decEq",
"code": "@[extern \"lean_uint32_dec_eq\"]\ndef UInt32.decEq (a b : UInt32) : Decidable (Eq a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ =>\n dite (Eq n m) (fun h => isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => UInt32.noConfusion h' (fun h' => absurd h' h)))",
"start": [
1975,
1
],
"end": [
1983,
123
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.decLt",
"code": "@[extern \"lean_uint32_dec_lt\"]\ndef UInt32.decLt (a b : UInt32) : Decidable (LT.lt a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (LT.lt n m))",
"start": [
1997,
1
],
"end": [
2004,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.decLe",
"code": "@[extern \"lean_uint32_dec_le\"]\ndef UInt32.decLe (a b : UInt32) : Decidable (LE.le a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (LE.le n m))",
"start": [
2007,
1
],
"end": [
2014,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.size",
"code": "abbrev UInt64.size : Nat := 18446744073709551616",
"start": [
2021,
1
],
"end": [
2022,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64",
"code": "structure UInt64 where\n \n val : Fin UInt64.size",
"start": [
2023,
1
],
"end": [
2030,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.ofNatCore",
"code": "@[extern \"lean_uint64_of_nat\"]\ndef UInt64.ofNatCore (n : @& Nat) (h : LT.lt n UInt64.size) : UInt64 where\n val := { val := n, isLt := h }",
"start": [
2035,
1
],
"end": [
2041,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.decEq",
"code": "@[extern \"lean_uint64_dec_eq\"]\ndef UInt64.decEq (a b : UInt64) : Decidable (Eq a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ =>\n dite (Eq n m) (fun h => isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => UInt64.noConfusion h' (fun h' => absurd h' h)))",
"start": [
2044,
1
],
"end": [
2052,
123
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.size",
"code": "abbrev USize.size : Nat := hAdd (hSub (hPow 2 System.Platform.numBits) 1) 1",
"start": [
2059,
1
],
"end": [
2078,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "usize_size_eq",
"code": "theorem usize_size_eq : Or (Eq USize.size 4294967296) (Eq USize.size 18446744073709551616)",
"start": [
2080,
1
],
"end": [
2084,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "USize",
"code": "structure USize where\n \n val : Fin USize.size",
"start": [
2086,
1
],
"end": [
2096,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.ofNatCore",
"code": "@[extern \"lean_usize_of_nat\"]\ndef USize.ofNatCore (n : @& Nat) (h : LT.lt n USize.size) : USize := {\n val := { val := n, isLt := h }\n}",
"start": [
2101,
1
],
"end": [
2108,
2
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.decEq",
"code": "@[extern \"lean_usize_dec_eq\"]\ndef USize.decEq (a b : USize) : Decidable (Eq a b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ =>\n dite (Eq n m) (fun h =>isTrue (h ▸ rfl)) (fun h => isFalse (fun h' => USize.noConfusion h' (fun h' => absurd h' h)))",
"start": [
2111,
1
],
"end": [
2119,
121
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.ofNat32",
"code": "@[extern \"lean_usize_of_nat\"]\ndef USize.ofNat32 (n : @& Nat) (h : LT.lt n 4294967296) : USize where\n val := {\n val := n\n isLt := match USize.size, usize_size_eq with\n | _, Or.inl rfl => h\n | _, Or.inr rfl => Nat.lt_trans h (by decide)\n }",
"start": [
2128,
1
],
"end": [
2140,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.isValidChar",
"code": "abbrev Nat.isValidChar (n : Nat) : Prop :=\n Or (LT.lt n 0xd800) (And (LT.lt 0xdfff n) (LT.lt n 0x110000))",
"start": [
2142,
1
],
"end": [
2147,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.isValidChar",
"code": "abbrev UInt32.isValidChar (n : UInt32) : Prop :=\n n.toNat.isValidChar",
"start": [
2149,
1
],
"end": [
2154,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Char",
"code": "structure Char where\n \n val : UInt32\n \n valid : val.isValidChar",
"start": [
2156,
1
],
"end": [
2162,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "isValidChar_UInt32",
"code": "private theorem isValidChar_UInt32 {n : Nat} (h : n.isValidChar) : LT.lt n UInt32.size",
"start": [
2164,
1
],
"end": [
2167,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ofNatAux",
"code": "@[extern \"lean_uint32_of_nat\"]\ndef Char.ofNatAux (n : @& Nat) (h : n.isValidChar) : Char :=\n { val := ⟨{ val := n, isLt := isValidChar_UInt32 h }⟩, valid := h }",
"start": [
2169,
1
],
"end": [
2175,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ofNat",
"code": "@[noinline, match_pattern]\ndef Char.ofNat (n : Nat) : Char :=\n dite (n.isValidChar)\n (fun h => Char.ofNatAux n h)\n (fun _ => { val := ⟨{ val := 0, isLt := by decide }⟩, valid := Or.inl (by decide) })",
"start": [
2177,
1
],
"end": [
2185,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.eq_of_val_eq",
"code": "theorem Char.eq_of_val_eq : ∀ {c d : Char}, Eq c.val d.val → Eq c d",
"start": [
2187,
1
],
"end": [
2188,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.val_eq_of_eq",
"code": "theorem Char.val_eq_of_eq : ∀ {c d : Char}, Eq c d → Eq c.val d.val",
"start": [
2190,
1
],
"end": [
2191,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ne_of_val_ne",
"code": "theorem Char.ne_of_val_ne {c d : Char} (h : Not (Eq c.val d.val)) : Not (Eq c d)",
"start": [
2193,
1
],
"end": [
2194,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.val_ne_of_ne",
"code": "theorem Char.val_ne_of_ne {c d : Char} (h : Not (Eq c d)) : Not (Eq c.val d.val)",
"start": [
2196,
1
],
"end": [
2197,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.utf8Size",
"code": "def Char.utf8Size (c : Char) : Nat :=\n let v := c.val\n ite (LE.le v (UInt32.ofNatCore 0x7F (by decide))) 1\n (ite (LE.le v (UInt32.ofNatCore 0x7FF (by decide))) 2\n (ite (LE.le v (UInt32.ofNatCore 0xFFFF (by decide))) 3 4))",
"start": [
2205,
1
],
"end": [
2210,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Option",
"code": "inductive Option (α : Type u) where\n \n | none : Option α\n \n | some (val : α) : Option α",
"start": [
2212,
1
],
"end": [
2244,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD",
"code": "@[macro_inline] def Option.getD (opt : Option α) (dflt : α) : α :=\n match opt with\n | some x => x\n | none => dflt",
"start": [
2253,
1
],
"end": [
2263,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map",
"code": "@[inline] protected def Option.map (f : α → β) : Option α → Option β\n | some x => some (f x)\n | none => none",
"start": [
2265,
1
],
"end": [
2271,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List",
"code": "inductive List (α : Type u) where\n \n | nil : List α\n \n | cons (head : α) (tail : List α) : List α",
"start": [
2273,
1
],
"end": [
2289,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.hasDecEq",
"code": "protected def List.hasDecEq {α : Type u} [DecidableEq α] : (a b : List α) → Decidable (Eq a b)\n | nil, nil => isTrue rfl\n | cons _ _, nil => isFalse (fun h => List.noConfusion h)\n | nil, cons _ _ => isFalse (fun h => List.noConfusion h)\n | cons a as, cons b bs =>\n match decEq a b with\n | isTrue hab =>\n match List.hasDecEq as bs with\n | isTrue habs => isTrue (hab ▸ habs ▸ rfl)\n | isFalse nabs => isFalse (fun h => List.noConfusion h (fun _ habs => absurd habs nabs))\n | isFalse nab => isFalse (fun h => List.noConfusion h (fun hab _ => absurd hab nab))",
"start": [
2294,
1
],
"end": [
2305,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length",
"code": "def List.length : List α → Nat\n | nil => 0\n | cons _ as => HAdd.hAdd (length as) 1",
"start": [
2309,
1
],
"end": [
2318,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lengthTRAux",
"code": "def List.lengthTRAux : List α → Nat → Nat\n | nil, n => n\n | cons _ as, n => lengthTRAux as (Nat.succ n)",
"start": [
2320,
1
],
"end": [
2323,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lengthTR",
"code": "def List.lengthTR (as : List α) : Nat :=\n lengthTRAux as 0",
"start": [
2325,
1
],
"end": [
2330,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get",
"code": "def List.get {α : Type u} : (as : List α) → Fin as.length → α\n | cons a _, ⟨0, _⟩ => a\n | cons _ as, ⟨Nat.succ i, h⟩ => get as ⟨i, Nat.le_of_succ_le_succ h⟩",
"start": [
2332,
1
],
"end": [
2339,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set",
"code": "def List.set : List α → Nat → α → List α\n | cons _ as, 0, b => cons b as\n | cons a as, Nat.succ n, b => cons a (set as n b)\n | nil, _, _ => nil",
"start": [
2341,
1
],
"end": [
2348,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl",
"code": "@[specialize]\ndef List.foldl {α : Type u} {β : Type v} (f : α → β → α) : (init : α) → List β → α\n | a, nil => a\n | a, cons b l => foldl f (f a b) l",
"start": [
2350,
1
],
"end": [
2357,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat",
"code": "def List.concat {α : Type u} : List α → α → List α\n | nil, b => cons b nil\n | cons a as, b => cons a (concat as b)",
"start": [
2359,
1
],
"end": [
2362,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "String",
"code": "structure String where\n \n mk ::\n \n data : List Char",
"start": [
2364,
1
],
"end": [
2376,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "String.decEq",
"code": "@[extern \"lean_string_dec_eq\"]\ndef String.decEq (s₁ s₂ : @& String) : Decidable (Eq s₁ s₂) :=\n match s₁, s₂ with\n | ⟨s₁⟩, ⟨s₂⟩ =>\n dite (Eq s₁ s₂) (fun h => isTrue (congrArg _ h)) (fun h => isFalse (fun h' => String.noConfusion h' (fun h' => absurd h' h)))",
"start": [
2381,
1
],
"end": [
2389,
130
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos",
"code": "structure String.Pos where\n \n byteIdx : Nat := 0",
"start": [
2393,
1
],
"end": [
2405,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring",
"code": "structure Substring where\n \n str : String\n \n startPos : String.Pos\n \n stopPos : String.Pos",
"start": [
2415,
1
],
"end": [
2427,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.bsize",
"code": "@[inline] def Substring.bsize : Substring → Nat\n | ⟨_, b, e⟩ => e.byteIdx.sub b.byteIdx",
"start": [
2432,
1
],
"end": [
2434,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8ByteSize",
"code": "@[extern \"lean_string_utf8_byte_size\"]\ndef String.utf8ByteSize : (@& String) → Nat\n | ⟨s⟩ => go s\nwhere\n go : List Char → Nat\n | .nil => 0\n | .cons c cs => hAdd (go cs) c.utf8Size",
"start": [
2436,
1
],
"end": [
2446,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.endPos",
"code": "@[inline] def String.endPos (s : String) : String.Pos where\n byteIdx := utf8ByteSize s",
"start": [
2472,
1
],
"end": [
2474,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toSubstring",
"code": "@[inline] def String.toSubstring (s : String) : Substring where\n str := s\n startPos := {}\n stopPos := s.endPos",
"start": [
2476,
1
],
"end": [
2480,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toSubstring'",
"code": "def String.toSubstring' (s : String) : Substring :=\n s.toSubstring",
"start": [
2482,
1
],
"end": [
2484,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "unsafeCast",
"code": "unsafe def unsafeCast {α : Sort u} {β : Sort v} (a : α) : β :=\n PLift.down (ULift.down.{max u v} (cast lcProof (ULift.up.{max u v} (PLift.up a))))",
"start": [
2486,
1
],
"end": [
2511,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "panicCore",
"code": "@[never_extract, extern \"lean_panic_fn\"]\ndef panicCore {α : Type u} [Inhabited α] (msg : String) : α := default",
"start": [
2514,
1
],
"end": [
2526,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "panic",
"code": "@[noinline, never_extract]\ndef panic {α : Type u} [Inhabited α] (msg : String) : α :=\n panicCore msg",
"start": [
2528,
1
],
"end": [
2541,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Array",
"code": "structure Array (α : Type u) where\n \n mk ::\n \n data : List α",
"start": [
2546,
1
],
"end": [
2571,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkEmpty",
"code": "@[extern \"lean_mk_empty_array_with_capacity\"]\ndef Array.mkEmpty {α : Type u} (c : @& Nat) : Array α where\n data := List.nil",
"start": [
2576,
1
],
"end": [
2579,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.empty",
"code": "def Array.empty {α : Type u} : Array α := mkEmpty 0",
"start": [
2581,
1
],
"end": [
2582,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size",
"code": "@[reducible, extern \"lean_array_get_size\"]\ndef Array.size {α : Type u} (a : @& Array α) : Nat :=\n a.data.length",
"start": [
2584,
1
],
"end": [
2587,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.get",
"code": "@[extern \"lean_array_fget\"]\ndef Array.get {α : Type u} (a : @& Array α) (i : @& Fin a.size) : α :=\n a.data.get i",
"start": [
2589,
1
],
"end": [
2592,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getD",
"code": "@[inline] abbrev Array.getD (a : Array α) (i : Nat) (v₀ : α) : α :=\n dite (LT.lt i a.size) (fun h => a.get ⟨i, h⟩) (fun _ => v₀)",
"start": [
2594,
1
],
"end": [
2596,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.get!",
"code": "@[extern \"lean_array_get\"]\ndef Array.get! {α : Type u} [Inhabited α] (a : @& Array α) (i : @& Nat) : α :=\n Array.getD a i default",
"start": [
2598,
1
],
"end": [
2601,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.push",
"code": "@[extern \"lean_array_push\"]\ndef Array.push {α : Type u} (a : Array α) (v : α) : Array α where\n data := List.concat a.data v",
"start": [
2603,
1
],
"end": [
2609,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray0",
"code": "def Array.mkArray0 {α : Type u} : Array α :=\n mkEmpty 0",
"start": [
2611,
1
],
"end": [
2613,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray1",
"code": "def Array.mkArray1 {α : Type u} (a₁ : α) : Array α :=\n (mkEmpty 1).push a₁",
"start": [
2615,
1
],
"end": [
2617,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray2",
"code": "def Array.mkArray2 {α : Type u} (a₁ a₂ : α) : Array α :=\n ((mkEmpty 2).push a₁).push a₂",
"start": [
2619,
1
],
"end": [
2621,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray3",
"code": "def Array.mkArray3 {α : Type u} (a₁ a₂ a₃ : α) : Array α :=\n (((mkEmpty 3).push a₁).push a₂).push a₃",
"start": [
2623,
1
],
"end": [
2625,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray4",
"code": "def Array.mkArray4 {α : Type u} (a₁ a₂ a₃ a₄ : α) : Array α :=\n ((((mkEmpty 4).push a₁).push a₂).push a₃).push a₄",
"start": [
2627,
1
],
"end": [
2629,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray5",
"code": "def Array.mkArray5 {α : Type u} (a₁ a₂ a₃ a₄ a₅ : α) : Array α :=\n (((((mkEmpty 5).push a₁).push a₂).push a₃).push a₄).push a₅",
"start": [
2631,
1
],
"end": [
2633,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray6",
"code": "def Array.mkArray6 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ : α) : Array α :=\n ((((((mkEmpty 6).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆",
"start": [
2635,
1
],
"end": [
2637,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray7",
"code": "def Array.mkArray7 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ a₇ : α) : Array α :=\n (((((((mkEmpty 7).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆).push a₇",
"start": [
2639,
1
],
"end": [
2641,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mkArray8",
"code": "def Array.mkArray8 {α : Type u} (a₁ a₂ a₃ a₄ a₅ a₆ a₇ a₈ : α) : Array α :=\n ((((((((mkEmpty 8).push a₁).push a₂).push a₃).push a₄).push a₅).push a₆).push a₇).push a₈",
"start": [
2643,
1
],
"end": [
2645,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.set",
"code": "@[extern \"lean_array_fset\"]\ndef Array.set (a : Array α) (i : @& Fin a.size) (v : α) : Array α where\n data := a.data.set i.val v",
"start": [
2647,
1
],
"end": [
2655,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.setD",
"code": "@[inline] def Array.setD (a : Array α) (i : Nat) (v : α) : Array α :=\n dite (LT.lt i a.size) (fun h => a.set ⟨i, h⟩ v) (fun _ => a)",
"start": [
2657,
1
],
"end": [
2664,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.set!",
"code": "@[extern \"lean_array_set\"]\ndef Array.set! (a : Array α) (i : @& Nat) (v : α) : Array α :=\n Array.setD a i v",
"start": [
2666,
1
],
"end": [
2674,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.appendCore",
"code": "protected def Array.appendCore {α : Type u} (as : Array α) (bs : Array α) : Array α :=\n let rec loop (i : Nat) (j : Nat) (as : Array α) : Array α :=\n dite (LT.lt j bs.size)\n (fun hlt =>\n match i with\n | 0 => as\n | Nat.succ i' => loop i' (hAdd j 1) (as.push (bs.get ⟨j, hlt⟩)))\n (fun _ => as)\n loop bs.size 0 as",
"start": [
2676,
1
],
"end": [
2685,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.extract",
"code": "def Array.extract (as : Array α) (start stop : Nat) : Array α :=\n let rec loop (i : Nat) (j : Nat) (bs : Array α) : Array α :=\n dite (LT.lt j as.size)\n (fun hlt =>\n match i with\n | 0 => bs\n | Nat.succ i' => loop i' (hAdd j 1) (bs.push (as.get ⟨j, hlt⟩)))\n (fun _ => bs)\n let sz' := Nat.sub (min stop as.size) start\n loop sz' start (mkEmpty sz')",
"start": [
2687,
1
],
"end": [
2701,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toArrayAux",
"code": "@[inline_if_reduce]\ndef List.toArrayAux : List α → Array α → Array α\n | nil, r => r\n | cons a as, r => toArrayAux as (r.push a)",
"start": [
2703,
1
],
"end": [
2707,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.redLength",
"code": "@[inline_if_reduce]\ndef List.redLength : List α → Nat\n | nil => 0\n | cons _ as => as.redLength.succ",
"start": [
2709,
1
],
"end": [
2713,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toArray",
"code": "@[inline, match_pattern, pp_nodot, export lean_list_to_array]\ndef List.toArray (as : List α) : Array α :=\n as.toArrayAux (Array.mkEmpty as.redLength)",
"start": [
2715,
1
],
"end": [
2720,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Bind",
"code": "class Bind (m : Type u → Type v) where\n \n bind : {α β : Type u} → m α → (α → m β) → m β",
"start": [
2722,
1
],
"end": [
2726,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Pure",
"code": "class Pure (f : Type u → Type v) where\n \n pure {α : Type u} : α → f α",
"start": [
2730,
1
],
"end": [
2734,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Functor",
"code": "class Functor (f : Type u → Type v) : Type (max (u+1) v) where\n \n map : {α β : Type u} → (α → β) → f α → f β\n \n mapConst : {α β : Type u} → α → f β → f α := Function.comp map (Function.const _)",
"start": [
2738,
1
],
"end": [
2752,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Seq",
"code": "class Seq (f : Type u → Type v) : Type (max (u+1) v) where\n \n seq : {α β : Type u} → f (α → β) → (Unit → f α) → f β",
"start": [
2754,
1
],
"end": [
2762,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "SeqLeft",
"code": "class SeqLeft (f : Type u → Type v) : Type (max (u+1) v) where\n \n seqLeft : {α β : Type u} → f α → (Unit → f β) → f α",
"start": [
2764,
1
],
"end": [
2771,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "SeqRight",
"code": "class SeqRight (f : Type u → Type v) : Type (max (u+1) v) where\n \n seqRight : {α β : Type u} → f α → (Unit → f β) → f β",
"start": [
2773,
1
],
"end": [
2780,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Applicative",
"code": "class Applicative (f : Type u → Type v) extends Functor f, Pure f, Seq f, SeqLeft f, SeqRight f where\n map := fun x y => Seq.seq (pure x) fun _ => y\n seqLeft := fun a b => Seq.seq (Functor.map (Function.const _) a) b\n seqRight := fun a b => Seq.seq (Functor.map (Function.const _ id) a) b",
"start": [
2782,
1
],
"end": [
2797,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Monad",
"code": "class Monad (m : Type u → Type v) extends Applicative m, Bind m : Type (max (u+1) v) where\n map f x := bind x (Function.comp pure f)\n seq f x := bind f fun y => Functor.map y (x ())\n seqLeft x y := bind x fun a => bind (y ()) (fun _ => pure a)\n seqRight x y := bind x fun _ => y ()",
"start": [
2799,
1
],
"end": [
2818,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.sequenceMap",
"code": "def Array.sequenceMap {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (f : α → m β) : m (Array β) :=\n let rec loop (i : Nat) (j : Nat) (bs : Array β) : m (Array β) :=\n dite (LT.lt j as.size)\n (fun hlt =>\n match i with\n | 0 => pure bs\n | Nat.succ i' => Bind.bind (f (as.get ⟨j, hlt⟩)) fun b => loop i' (hAdd j 1) (bs.push b))\n (fun _ => pure bs)\n loop as.size 0 (Array.mkEmpty as.size)",
"start": [
2829,
1
],
"end": [
2838,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadLift",
"code": "class MonadLift (m : semiOutParam (Type u → Type v)) (n : Type u → Type w) where\n \n monadLift : {α : Type u} → m α → n α",
"start": [
2840,
1
],
"end": [
2850,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadLiftT",
"code": "class MonadLiftT (m : Type u → Type v) (n : Type u → Type w) where\n \n monadLift : {α : Type u} → m α → n α",
"start": [
2852,
1
],
"end": [
2861,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "liftM",
"code": "abbrev liftM := @monadLift",
"start": [
2865,
1
],
"end": [
2866,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadFunctor",
"code": "class MonadFunctor (m : semiOutParam (Type u → Type v)) (n : Type u → Type w) where\n \n monadMap {α : Type u} : ({β : Type u} → m β → m β) → n α → n α",
"start": [
2875,
1
],
"end": [
2886,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadFunctorT",
"code": "class MonadFunctorT (m : Type u → Type v) (n : Type u → Type w) where\n \n monadMap {α : Type u} : ({β : Type u} → m β → m β) → n α → n α",
"start": [
2888,
1
],
"end": [
2893,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "monadFunctorRefl",
"code": "instance monadFunctorRefl (m) : MonadFunctorT m m where\n monadMap f := f",
"start": [
2901,
1
],
"end": [
2902,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Except",
"code": "inductive Except (ε : Type u) (α : Type v) where\n \n | error : ε → Except ε α\n \n | ok : α → Except ε α",
"start": [
2904,
1
],
"end": [
2914,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadExceptOf",
"code": "class MonadExceptOf (ε : semiOutParam (Type u)) (m : Type v → Type w) where\n \n throw {α : Type v} : ε → m α\n \n tryCatch {α : Type v} (body : m α) (handler : ε → m α) : m α",
"start": [
2921,
1
],
"end": [
2943,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "throwThe",
"code": "abbrev throwThe (ε : Type u) {m : Type v → Type w} [MonadExceptOf ε m] {α : Type v} (e : ε) : m α :=\n MonadExceptOf.throw e",
"start": [
2945,
1
],
"end": [
2950,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "tryCatchThe",
"code": "abbrev tryCatchThe (ε : Type u) {m : Type v → Type w} [MonadExceptOf ε m] {α : Type v} (x : m α) (handle : ε → m α) : m α :=\n MonadExceptOf.tryCatch x handle",
"start": [
2952,
1
],
"end": [
2957,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadExcept",
"code": "class MonadExcept (ε : outParam (Type u)) (m : Type v → Type w) where\n \n throw {α : Type v} : ε → m α\n \n tryCatch {α : Type v} : m α → (ε → m α) → m α",
"start": [
2959,
1
],
"end": [
2967,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadExcept.ofExcept",
"code": "def MonadExcept.ofExcept [Monad m] [MonadExcept ε m] : Except ε α → m α\n | .ok a => pure a\n | .error e => throw e",
"start": [
2969,
1
],
"end": [
2972,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadExcept.orElse",
"code": "@[inline] protected def orElse [MonadExcept ε m] {α : Type v} (t₁ : m α) (t₂ : Unit → m α) : m α :=\n tryCatch t₁ fun _ => t₂ ()",
"start": [
2983,
1
],
"end": [
2985,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT",
"code": "def ReaderT (ρ : Type u) (m : Type u → Type v) (α : Type u) : Type (max u v) :=\n ρ → m α",
"start": [
2992,
1
],
"end": [
2999,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.run",
"code": "@[always_inline, inline]\ndef ReaderT.run {ρ : Type u} {m : Type u → Type v} {α : Type u} (x : ReaderT ρ m α) (r : ρ) : m α :=\n x r",
"start": [
3004,
1
],
"end": [
3010,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.read",
"code": "@[always_inline, inline]\nprotected def read [Monad m] : ReaderT ρ m ρ :=\n pure",
"start": [
3030,
1
],
"end": [
3033,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.pure",
"code": "@[always_inline, inline]\nprotected def pure [Monad m] {α} (a : α) : ReaderT ρ m α :=\n fun _ => pure a",
"start": [
3035,
1
],
"end": [
3038,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.bind",
"code": "@[always_inline, inline]\nprotected def bind [Monad m] {α β} (x : ReaderT ρ m α) (f : α → ReaderT ρ m β) : ReaderT ρ m β :=\n fun r => bind (x r) fun a => f a r",
"start": [
3040,
1
],
"end": [
3043,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.adapt",
"code": "@[always_inline, inline]\nprotected def adapt {ρ' α : Type u} (f : ρ' → ρ) : ReaderT ρ m α → ReaderT ρ' m α :=\n fun x r => x (f r)",
"start": [
3063,
1
],
"end": [
3069,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadReaderOf",
"code": "class MonadReaderOf (ρ : semiOutParam (Type u)) (m : Type u → Type v) where\n \n read : m ρ",
"start": [
3074,
1
],
"end": [
3090,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "readThe",
"code": "@[always_inline, inline]\ndef readThe (ρ : Type u) {m : Type u → Type v} [MonadReaderOf ρ m] : m ρ :=\n MonadReaderOf.read",
"start": [
3092,
1
],
"end": [
3098,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadReader",
"code": "class MonadReader (ρ : outParam (Type u)) (m : Type u → Type v) where\n \n read : m ρ",
"start": [
3100,
1
],
"end": [
3103,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadWithReaderOf",
"code": "class MonadWithReaderOf (ρ : semiOutParam (Type u)) (m : Type u → Type v) where\n \n withReader {α : Type u} : (ρ → ρ) → m α → m α",
"start": [
3116,
1
],
"end": [
3126,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "withTheReader",
"code": "@[always_inline, inline]\ndef withTheReader (ρ : Type u) {m : Type u → Type v} [MonadWithReaderOf ρ m] {α : Type u} (f : ρ → ρ) (x : m α) : m α :=\n MonadWithReaderOf.withReader f x",
"start": [
3128,
1
],
"end": [
3134,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadWithReader",
"code": "class MonadWithReader (ρ : outParam (Type u)) (m : Type u → Type v) where\n \n withReader {α : Type u} : (ρ → ρ) → m α → m α",
"start": [
3136,
1
],
"end": [
3140,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadStateOf",
"code": "class MonadStateOf (σ : semiOutParam (Type u)) (m : Type u → Type v) where\n \n get : m σ\n \n set : σ → m PUnit\n \n modifyGet {α : Type u} : (σ → Prod α σ) → m α",
"start": [
3153,
1
],
"end": [
3170,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "getThe",
"code": "abbrev getThe (σ : Type u) {m : Type u → Type v} [MonadStateOf σ m] : m σ :=\n MonadStateOf.get",
"start": [
3174,
1
],
"end": [
3179,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "modifyThe",
"code": "@[always_inline, inline]\nabbrev modifyThe (σ : Type u) {m : Type u → Type v} [MonadStateOf σ m] (f : σ → σ) : m PUnit :=\n MonadStateOf.modifyGet fun s => (PUnit.unit, f s)",
"start": [
3181,
1
],
"end": [
3187,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "modifyGetThe",
"code": "@[always_inline, inline]\nabbrev modifyGetThe {α : Type u} (σ : Type u) {m : Type u → Type v} [MonadStateOf σ m] (f : σ → Prod α σ) : m α :=\n MonadStateOf.modifyGet f",
"start": [
3189,
1
],
"end": [
3195,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadState",
"code": "class MonadState (σ : outParam (Type u)) (m : Type u → Type v) where\n \n get : m σ\n \n set : σ → m PUnit\n \n modifyGet {α : Type u} : (σ → Prod α σ) → m α",
"start": [
3197,
1
],
"end": [
3209,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "modify",
"code": "@[always_inline, inline]\ndef modify {σ : Type u} {m : Type u → Type v} [MonadState σ m] (f : σ → σ) : m PUnit :=\n modifyGet fun s => (PUnit.unit, f s)",
"start": [
3218,
1
],
"end": [
3226,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "getModify",
"code": "@[always_inline, inline]\ndef getModify {σ : Type u} {m : Type u → Type v} [MonadState σ m] (f : σ → σ) : m σ :=\n modifyGet fun s => (s, f s)",
"start": [
3228,
1
],
"end": [
3234,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.Result",
"code": "inductive Result (ε σ α : Type u) where\n \n | ok : α → σ → Result ε σ α\n \n | error : ε → σ → Result ε σ α",
"start": [
3246,
1
],
"end": [
3254,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM",
"code": "def EStateM (ε σ α : Type u) := σ → Result ε σ α",
"start": [
3264,
1
],
"end": [
3268,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.pure",
"code": "@[always_inline, inline]\nprotected def pure (a : α) : EStateM ε σ α := fun s =>\n Result.ok a s",
"start": [
3277,
1
],
"end": [
3280,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.set",
"code": "@[always_inline, inline]\nprotected def set (s : σ) : EStateM ε σ PUnit := fun _ =>\n Result.ok ⟨⟩ s",
"start": [
3282,
1
],
"end": [
3285,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.get",
"code": "@[always_inline, inline]\nprotected def get : EStateM ε σ σ := fun s =>\n Result.ok s s",
"start": [
3287,
1
],
"end": [
3290,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.modifyGet",
"code": "@[always_inline, inline]\nprotected def modifyGet (f : σ → Prod α σ) : EStateM ε σ α := fun s =>\n match f s with\n | (a, s) => Result.ok a s",
"start": [
3292,
1
],
"end": [
3296,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.throw",
"code": "@[always_inline, inline]\nprotected def throw (e : ε) : EStateM ε σ α := fun s =>\n Result.error e s",
"start": [
3298,
1
],
"end": [
3301,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.Backtrackable",
"code": "class Backtrackable (δ : outParam (Type u)) (σ : Type u) where\n \n save : σ → δ\n \n restore : σ → δ → σ",
"start": [
3303,
1
],
"end": [
3313,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.tryCatch",
"code": "@[always_inline, inline]\nprotected def tryCatch {δ} [Backtrackable δ σ] {α} (x : EStateM ε σ α) (handle : ε → EStateM ε σ α) : EStateM ε σ α := fun s =>\n let d := Backtrackable.save s\n match x s with\n | Result.error e s => handle e (Backtrackable.restore s d)\n | ok => ok",
"start": [
3315,
1
],
"end": [
3321,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.orElse",
"code": "@[always_inline, inline]\nprotected def orElse {δ} [Backtrackable δ σ] (x₁ : EStateM ε σ α) (x₂ : Unit → EStateM ε σ α) : EStateM ε σ α := fun s =>\n let d := Backtrackable.save s;\n match x₁ s with\n | Result.error _ s => x₂ () (Backtrackable.restore s d)\n | ok => ok",
"start": [
3323,
1
],
"end": [
3329,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.adaptExcept",
"code": "@[always_inline, inline]\ndef adaptExcept {ε' : Type u} (f : ε → ε') (x : EStateM ε σ α) : EStateM ε' σ α := fun s =>\n match x s with\n | Result.error e s => Result.error (f e) s\n | Result.ok a s => Result.ok a s",
"start": [
3331,
1
],
"end": [
3336,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.bind",
"code": "@[always_inline, inline]\nprotected def bind (x : EStateM ε σ α) (f : α → EStateM ε σ β) : EStateM ε σ β := fun s =>\n match x s with\n | Result.ok a s => f a s\n | Result.error e s => Result.error e s",
"start": [
3338,
1
],
"end": [
3343,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.map",
"code": "@[always_inline, inline]\nprotected def map (f : α → β) (x : EStateM ε σ α) : EStateM ε σ β := fun s =>\n match x s with\n | Result.ok a s => Result.ok (f a) s\n | Result.error e s => Result.error e s",
"start": [
3345,
1
],
"end": [
3350,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.seqRight",
"code": "@[always_inline, inline]\nprotected def seqRight (x : EStateM ε σ α) (y : Unit → EStateM ε σ β) : EStateM ε σ β := fun s =>\n match x s with\n | Result.ok _ s => y () s\n | Result.error e s => Result.error e s",
"start": [
3352,
1
],
"end": [
3357,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.instMonad",
"code": "@[always_inline]\ninstance instMonad : Monad (EStateM ε σ) where\n bind := EStateM.bind\n pure := EStateM.pure\n map := EStateM.map\n seqRight := EStateM.seqRight",
"start": [
3359,
1
],
"end": [
3364,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.run",
"code": "@[always_inline, inline]\ndef run (x : EStateM ε σ α) (s : σ) : Result ε σ α := x s",
"start": [
3378,
1
],
"end": [
3380,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.run'",
"code": "@[always_inline, inline]\ndef run' (x : EStateM ε σ α) (s : σ) : Option α :=\n match run x s with\n | Result.ok v _ => some v\n | Result.error .. => none",
"start": [
3382,
1
],
"end": [
3390,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.dummySave",
"code": "@[inline] def dummySave : σ → PUnit := fun _ => ⟨⟩",
"start": [
3392,
1
],
"end": [
3393,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.dummyRestore",
"code": "@[inline] def dummyRestore : σ → PUnit → σ := fun s _ => s",
"start": [
3395,
1
],
"end": [
3396,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.nonBacktrackable",
"code": "instance nonBacktrackable : Backtrackable PUnit σ where\n save := dummySave\n restore := dummyRestore",
"start": [
3398,
1
],
"end": [
3406,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Hashable",
"code": "class Hashable (α : Sort u) where\n \n hash : α → UInt64",
"start": [
3410,
1
],
"end": [
3413,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.toUSize",
"code": "@[extern \"lean_uint64_to_usize\"]\nopaque UInt64.toUSize (u : UInt64) : USize",
"start": [
3417,
1
],
"end": [
3419,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.toUInt64",
"code": "@[extern \"lean_usize_to_uint64\"]\ndef USize.toUInt64 (u : USize) : UInt64 where\n val := {\n val := u.val.val\n isLt :=\n let ⟨n, h⟩ := u\n show LT.lt n _ from\n match USize.size, usize_size_eq, h with\n | _, Or.inl rfl, h => Nat.lt_trans h (by decide)\n | _, Or.inr rfl, h => h\n }",
"start": [
3421,
1
],
"end": [
3436,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "mixHash",
"code": "@[extern \"lean_uint64_mix_hash\"]\nopaque mixHash (u₁ u₂ : UInt64) : UInt64",
"start": [
3438,
1
],
"end": [
3440,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "String.hash",
"code": "@[extern \"lean_string_hash\"]\nprotected opaque String.hash (s : @& String) : UInt64",
"start": [
3445,
1
],
"end": [
3447,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name",
"code": "inductive Name where\n \n | anonymous : Name\n \n | str (pre : Name) (str : String)\n \n | num (pre : Name) (i : Nat)\nwith\n \n @[computed_field] hash : Name → UInt64\n | .anonymous => .ofNatCore 1723 (by decide)\n | .str p s => mixHash p.hash s.hash\n | .num p v => mixHash p.hash (dite (LT.lt v UInt64.size) (fun h => UInt64.ofNatCore v h) (fun _ => UInt64.ofNatCore 17 (by decide)))",
"start": [
3454,
1
],
"end": [
3505,
137
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr",
"code": "@[export lean_name_mk_string]\nabbrev mkStr (p : Name) (s : String) : Name :=\n Name.str p s",
"start": [
3515,
1
],
"end": [
3520,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkNum",
"code": "@[export lean_name_mk_numeral]\nabbrev mkNum (p : Name) (v : Nat) : Name :=\n Name.num p v",
"start": [
3522,
1
],
"end": [
3527,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkSimple",
"code": "abbrev mkSimple (s : String) : Name :=\n .str .anonymous s",
"start": [
3529,
1
],
"end": [
3535,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr1",
"code": "@[reducible] def mkStr1 (s₁ : String) : Name :=\n .str .anonymous s₁",
"start": [
3537,
1
],
"end": [
3539,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr2",
"code": "@[reducible] def mkStr2 (s₁ s₂ : String) : Name :=\n .str (.str .anonymous s₁) s₂",
"start": [
3541,
1
],
"end": [
3543,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr3",
"code": "@[reducible] def mkStr3 (s₁ s₂ s₃ : String) : Name :=\n .str (.str (.str .anonymous s₁) s₂) s₃",
"start": [
3545,
1
],
"end": [
3547,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr4",
"code": "@[reducible] def mkStr4 (s₁ s₂ s₃ s₄ : String) : Name :=\n .str (.str (.str (.str .anonymous s₁) s₂) s₃) s₄",
"start": [
3549,
1
],
"end": [
3551,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr5",
"code": "@[reducible] def mkStr5 (s₁ s₂ s₃ s₄ s₅ : String) : Name :=\n .str (.str (.str (.str (.str .anonymous s₁) s₂) s₃) s₄) s₅",
"start": [
3553,
1
],
"end": [
3555,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr6",
"code": "@[reducible] def mkStr6 (s₁ s₂ s₃ s₄ s₅ s₆ : String) : Name :=\n .str (.str (.str (.str (.str (.str .anonymous s₁) s₂) s₃) s₄) s₅) s₆",
"start": [
3557,
1
],
"end": [
3559,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr7",
"code": "@[reducible] def mkStr7 (s₁ s₂ s₃ s₄ s₅ s₆ s₇ : String) : Name :=\n .str (.str (.str (.str (.str (.str (.str .anonymous s₁) s₂) s₃) s₄) s₅) s₆) s₇",
"start": [
3561,
1
],
"end": [
3563,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.mkStr8",
"code": "@[reducible] def mkStr8 (s₁ s₂ s₃ s₄ s₅ s₆ s₇ s₈ : String) : Name :=\n .str (.str (.str (.str (.str (.str (.str (.str .anonymous s₁) s₂) s₃) s₄) s₅) s₆) s₇) s₈",
"start": [
3565,
1
],
"end": [
3567,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.beq",
"code": "@[extern \"lean_name_eq\"]\nprotected def beq : (@& Name) → (@& Name) → Bool\n | anonymous, anonymous => true\n | str p₁ s₁, str p₂ s₂ => and (BEq.beq s₁ s₂) (Name.beq p₁ p₂)\n | num p₁ n₁, num p₂ n₂ => and (BEq.beq n₁ n₂) (Name.beq p₁ p₂)\n | _, _ => false",
"start": [
3569,
1
],
"end": [
3575,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.appendCore",
"code": "def appendCore : Name → Name → Name\n | n, .anonymous => n\n | n, .str p s => .str (appendCore n p) s\n | n, .num p d => .num (appendCore n p) d",
"start": [
3580,
1
],
"end": [
3587,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SourceInfo",
"code": "inductive SourceInfo where\n \n | original (leading : Substring) (pos : String.Pos) (trailing : Substring) (endPos : String.Pos)\n \n | synthetic (pos : String.Pos) (endPos : String.Pos) (canonical := false)\n \n | protected none",
"start": [
3593,
1
],
"end": [
3626,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SourceInfo.getPos?",
"code": "def getPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos :=\n match info, canonicalOnly with\n | original (pos := pos) .., _\n | synthetic (pos := pos) (canonical := true) .., _\n | synthetic (pos := pos) .., false => some pos\n | _, _ => none",
"start": [
3632,
1
],
"end": [
3641,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SourceInfo.getTailPos?",
"code": "def getTailPos? (info : SourceInfo) (canonicalOnly := false) : Option String.Pos :=\n match info, canonicalOnly with\n | original (endPos := endPos) .., _\n | synthetic (endPos := endPos) (canonical := true) .., _\n | synthetic (endPos := endPos) .., false => some endPos\n | _, _ => none",
"start": [
3643,
1
],
"end": [
3652,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SyntaxNodeKind",
"code": "abbrev SyntaxNodeKind := Name",
"start": [
3656,
1
],
"end": [
3663,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Preresolved",
"code": "inductive Syntax.Preresolved where\n \n | namespace (ns : Name)\n \n | decl (n : Name) (fields : List String)",
"start": [
3667,
1
],
"end": [
3676,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax",
"code": "inductive Syntax where\n \n | missing : Syntax\n \n | node (info : SourceInfo) (kind : SyntaxNodeKind) (args : Array Syntax) : Syntax\n \n | atom (info : SourceInfo) (val : String) : Syntax\n \n | ident (info : SourceInfo) (rawVal : Substring) (val : Name) (preresolved : List Syntax.Preresolved) : Syntax",
"start": [
3678,
1
],
"end": [
3716,
114
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node1",
"code": "def Syntax.node1 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray1 a₁)",
"start": [
3718,
1
],
"end": [
3720,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node2",
"code": "def Syntax.node2 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray2 a₁ a₂)",
"start": [
3722,
1
],
"end": [
3724,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node3",
"code": "def Syntax.node3 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray3 a₁ a₂ a₃)",
"start": [
3726,
1
],
"end": [
3728,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node4",
"code": "def Syntax.node4 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ a₄ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray4 a₁ a₂ a₃ a₄)",
"start": [
3730,
1
],
"end": [
3732,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node5",
"code": "def Syntax.node5 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ a₄ a₅ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray5 a₁ a₂ a₃ a₄ a₅)",
"start": [
3734,
1
],
"end": [
3736,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node6",
"code": "def Syntax.node6 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ a₄ a₅ a₆ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray6 a₁ a₂ a₃ a₄ a₅ a₆)",
"start": [
3738,
1
],
"end": [
3740,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node7",
"code": "def Syntax.node7 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ a₄ a₅ a₆ a₇ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray7 a₁ a₂ a₃ a₄ a₅ a₆ a₇)",
"start": [
3742,
1
],
"end": [
3744,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.node8",
"code": "def Syntax.node8 (info : SourceInfo) (kind : SyntaxNodeKind) (a₁ a₂ a₃ a₄ a₅ a₆ a₇ a₈ : Syntax) : Syntax :=\n Syntax.node info kind (Array.mkArray8 a₁ a₂ a₃ a₄ a₅ a₆ a₇ a₈)",
"start": [
3746,
1
],
"end": [
3748,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SyntaxNodeKinds",
"code": "def SyntaxNodeKinds := List SyntaxNodeKind",
"start": [
3750,
1
],
"end": [
3751,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax",
"code": "structure TSyntax (ks : SyntaxNodeKinds) where\n \n raw : Syntax",
"start": [
3753,
1
],
"end": [
3762,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.choiceKind",
"code": "abbrev choiceKind : SyntaxNodeKind := `choice",
"start": [
3772,
1
],
"end": [
3776,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.nullKind",
"code": "abbrev nullKind : SyntaxNodeKind := `null",
"start": [
3778,
1
],
"end": [
3779,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.groupKind",
"code": "abbrev groupKind : SyntaxNodeKind := `group",
"start": [
3781,
1
],
"end": [
3785,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.identKind",
"code": "abbrev identKind : SyntaxNodeKind := `ident",
"start": [
3787,
1
],
"end": [
3792,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.strLitKind",
"code": "abbrev strLitKind : SyntaxNodeKind := `str",
"start": [
3794,
1
],
"end": [
3795,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.charLitKind",
"code": "abbrev charLitKind : SyntaxNodeKind := `char",
"start": [
3797,
1
],
"end": [
3798,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.numLitKind",
"code": "abbrev numLitKind : SyntaxNodeKind := `num",
"start": [
3800,
1
],
"end": [
3801,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.scientificLitKind",
"code": "abbrev scientificLitKind : SyntaxNodeKind := `scientific",
"start": [
3803,
1
],
"end": [
3804,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.nameLitKind",
"code": "abbrev nameLitKind : SyntaxNodeKind := `name",
"start": [
3806,
1
],
"end": [
3807,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.fieldIdxKind",
"code": "abbrev fieldIdxKind : SyntaxNodeKind := `fieldIdx",
"start": [
3809,
1
],
"end": [
3810,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.hygieneInfoKind",
"code": "abbrev hygieneInfoKind : SyntaxNodeKind := `hygieneInfo",
"start": [
3812,
1
],
"end": [
3820,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.interpolatedStrLitKind",
"code": "abbrev interpolatedStrLitKind : SyntaxNodeKind := `interpolatedStrLitKind",
"start": [
3822,
1
],
"end": [
3826,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.interpolatedStrKind",
"code": "abbrev interpolatedStrKind : SyntaxNodeKind := `interpolatedStrKind",
"start": [
3827,
1
],
"end": [
3831,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkNode",
"code": "@[inline] def mkNode (k : SyntaxNodeKind) (args : Array Syntax) : TSyntax (.cons k .nil) :=\n ⟨Syntax.node SourceInfo.none k args⟩",
"start": [
3833,
1
],
"end": [
3835,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkNullNode",
"code": "@[inline] def mkNullNode (args : Array Syntax := Array.empty) : Syntax :=\n mkNode nullKind args |>.raw",
"start": [
3837,
1
],
"end": [
3840,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getKind",
"code": "def getKind (stx : Syntax) : SyntaxNodeKind :=\n match stx with\n | Syntax.node _ k _ => k\n | Syntax.missing => `missing\n | Syntax.atom _ v => Name.mkSimple v\n | Syntax.ident .. => identKind",
"start": [
3844,
1
],
"end": [
3857,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setKind",
"code": "def setKind (stx : Syntax) (k : SyntaxNodeKind) : Syntax :=\n match stx with\n | Syntax.node info _ args => Syntax.node info k args\n | _ => stx",
"start": [
3859,
1
],
"end": [
3866,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isOfKind",
"code": "def isOfKind (stx : Syntax) (k : SyntaxNodeKind) : Bool :=\n beq stx.getKind k",
"start": [
3868,
1
],
"end": [
3870,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getArg",
"code": "def getArg (stx : Syntax) (i : Nat) : Syntax :=\n match stx with\n | Syntax.node _ _ args => args.getD i Syntax.missing\n | _ => Syntax.missing",
"start": [
3872,
1
],
"end": [
3879,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getArgs",
"code": "def getArgs (stx : Syntax) : Array Syntax :=\n match stx with\n | Syntax.node _ _ args => args\n | _ => Array.empty",
"start": [
3881,
1
],
"end": [
3885,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getNumArgs",
"code": "def getNumArgs (stx : Syntax) : Nat :=\n match stx with\n | Syntax.node _ _ args => args.size\n | _ => 0",
"start": [
3887,
1
],
"end": [
3891,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getOptional?",
"code": "def getOptional? (stx : Syntax) : Option Syntax :=\n match stx with\n | Syntax.node _ k args => match and (beq k nullKind) (beq args.size 1) with\n | true => some (args.get! 0)\n | false => none\n | _ => none",
"start": [
3893,
1
],
"end": [
3902,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isMissing",
"code": "def isMissing : Syntax → Bool\n | Syntax.missing => true\n | _ => false",
"start": [
3904,
1
],
"end": [
3907,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isNodeOf",
"code": "def isNodeOf (stx : Syntax) (k : SyntaxNodeKind) (n : Nat) : Bool :=\n and (stx.isOfKind k) (beq stx.getNumArgs n)",
"start": [
3909,
1
],
"end": [
3911,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isIdent",
"code": "def isIdent : Syntax → Bool\n | ident .. => true\n | _ => false",
"start": [
3913,
1
],
"end": [
3916,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getId",
"code": "def getId : Syntax → Name\n | ident _ _ val _ => val\n | _ => Name.anonymous",
"start": [
3918,
1
],
"end": [
3921,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setArgs",
"code": "def setArgs (stx : Syntax) (args : Array Syntax) : Syntax :=\n match stx with\n | node info k _ => node info k args\n | stx => stx",
"start": [
3923,
1
],
"end": [
3930,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setArg",
"code": "def setArg (stx : Syntax) (i : Nat) (arg : Syntax) : Syntax :=\n match stx with\n | node info k args => node info k (args.setD i arg)\n | stx => stx",
"start": [
3932,
1
],
"end": [
3939,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getHeadInfo?",
"code": "partial def getHeadInfo? : Syntax → Option SourceInfo\n | atom info _ => some info\n | ident info .. => some info\n | node SourceInfo.none _ args =>\n let rec loop (i : Nat) : Option SourceInfo :=\n match decide (LT.lt i args.size) with\n | true => match getHeadInfo? (args.get! i) with\n | some info => some info\n | none => loop (hAdd i 1)\n | false => none\n loop 0\n | node info _ _ => some info\n | _ => none",
"start": [
3941,
1
],
"end": [
3954,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getHeadInfo",
"code": "partial def getHeadInfo (stx : Syntax) : SourceInfo :=\n match stx.getHeadInfo? with\n | some info => info\n | none => SourceInfo.none",
"start": [
3956,
1
],
"end": [
3960,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getPos?",
"code": "def getPos? (stx : Syntax) (canonicalOnly := false) : Option String.Pos :=\n stx.getHeadInfo.getPos? canonicalOnly",
"start": [
3962,
1
],
"end": [
3968,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getTailPos?",
"code": "partial def getTailPos? (stx : Syntax) (canonicalOnly := false) : Option String.Pos :=\n match stx, canonicalOnly with\n | atom (SourceInfo.original (endPos := pos) ..) .., _\n | atom (SourceInfo.synthetic (endPos := pos) (canonical := true) ..) _, _\n | atom (SourceInfo.synthetic (endPos := pos) ..) _, false\n | ident (SourceInfo.original (endPos := pos) ..) .., _\n | ident (SourceInfo.synthetic (endPos := pos) (canonical := true) ..) .., _\n | ident (SourceInfo.synthetic (endPos := pos) ..) .., false\n | node (SourceInfo.original (endPos := pos) ..) .., _\n | node (SourceInfo.synthetic (endPos := pos) (canonical := true) ..) .., _\n | node (SourceInfo.synthetic (endPos := pos) ..) .., false => some pos\n | node _ _ args, _ =>\n let rec loop (i : Nat) : Option String.Pos :=\n match decide (LT.lt i args.size) with\n | true => match getTailPos? (args.get! ((args.size.sub i).sub 1)) canonicalOnly with\n | some info => some info\n | none => loop (hAdd i 1)\n | false => none\n loop 0\n | _, _ => none",
"start": [
3971,
1
],
"end": [
3995,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.SepArray",
"code": "structure SepArray (sep : String) where\n \n elemsAndSeps : Array Syntax",
"start": [
3997,
1
],
"end": [
4004,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.TSepArray",
"code": "structure TSepArray (ks : SyntaxNodeKinds) (sep : String) where\n \n elemsAndSeps : Array Syntax",
"start": [
4006,
1
],
"end": [
4010,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntaxArray",
"code": "abbrev TSyntaxArray (ks : SyntaxNodeKinds) := Array (TSyntax ks)",
"start": [
4014,
1
],
"end": [
4015,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntaxArray.rawImpl",
"code": "unsafe def TSyntaxArray.rawImpl : TSyntaxArray ks → Array Syntax := unsafeCast",
"start": [
4017,
1
],
"end": [
4018,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntaxArray.raw",
"code": "@[implemented_by TSyntaxArray.rawImpl]\nopaque TSyntaxArray.raw (as : TSyntaxArray ks) : Array Syntax := Array.empty",
"start": [
4020,
1
],
"end": [
4022,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntaxArray.mkImpl",
"code": "unsafe def TSyntaxArray.mkImpl : Array Syntax → TSyntaxArray ks := unsafeCast",
"start": [
4024,
1
],
"end": [
4025,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntaxArray.mk",
"code": "@[implemented_by TSyntaxArray.mkImpl]\nopaque TSyntaxArray.mk (as : Array Syntax) : TSyntaxArray ks := Array.empty",
"start": [
4027,
1
],
"end": [
4029,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SourceInfo.fromRef",
"code": "def SourceInfo.fromRef (ref : Syntax) (canonical := false) : SourceInfo :=\n let noncanonical ref :=\n match ref.getPos?, ref.getTailPos? with\n | some pos, some tailPos => .synthetic pos tailPos\n | _, _ => .none\n match canonical with\n | true =>\n match ref.getPos? true, ref.getTailPos? true with\n | some pos, some tailPos => .synthetic pos tailPos true\n | _, _ => noncanonical ref\n | false => noncanonical ref",
"start": [
4031,
1
],
"end": [
4042,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkAtom",
"code": "def mkAtom (val : String) : Syntax :=\n Syntax.atom SourceInfo.none val",
"start": [
4044,
1
],
"end": [
4046,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkAtomFrom",
"code": "def mkAtomFrom (src : Syntax) (val : String) (canonical := false) : Syntax :=\n Syntax.atom (SourceInfo.fromRef src canonical) val",
"start": [
4048,
1
],
"end": [
4050,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.ParserDescr",
"code": "inductive ParserDescr where\n \n | const (name : Name)\n \n | unary (name : Name) (p : ParserDescr)\n \n | binary (name : Name) (p₁ p₂ : ParserDescr)\n \n | node (kind : SyntaxNodeKind) (prec : Nat) (p : ParserDescr)\n \n | trailingNode (kind : SyntaxNodeKind) (prec lhsPrec : Nat) (p : ParserDescr)\n \n | symbol (val : String)\n \n | nonReservedSymbol (val : String) (includeIdent : Bool)\n \n | cat (catName : Name) (rbp : Nat)\n \n | parser (declName : Name)\n \n | nodeWithAntiquot (name : String) (kind : SyntaxNodeKind) (p : ParserDescr)\n \n | sepBy (p : ParserDescr) (sep : String) (psep : ParserDescr) (allowTrailingSep : Bool := false)\n \n | sepBy1 (p : ParserDescr) (sep : String) (psep : ParserDescr) (allowTrailingSep : Bool := false)",
"start": [
4054,
1
],
"end": [
4100,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TrailingParserDescr",
"code": "abbrev TrailingParserDescr := ParserDescr",
"start": [
4105,
1
],
"end": [
4111,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MacroScope",
"code": "abbrev MacroScope := Nat",
"start": [
4119,
1
],
"end": [
4125,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.reservedMacroScope",
"code": "def reservedMacroScope := 0",
"start": [
4126,
1
],
"end": [
4127,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.firstFrontendMacroScope",
"code": "def firstFrontendMacroScope := hAdd reservedMacroScope 1",
"start": [
4128,
1
],
"end": [
4129,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MonadRef",
"code": "class MonadRef (m : Type → Type) where\n \n getRef : m Syntax\n \n withRef {α} : Syntax → m α → m α",
"start": [
4131,
1
],
"end": [
4141,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.replaceRef",
"code": "def replaceRef (ref : Syntax) (oldRef : Syntax) : Syntax :=\n match ref.getPos? with\n | some _ => ref\n | _ => oldRef",
"start": [
4149,
1
],
"end": [
4156,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.withRef",
"code": "@[always_inline, inline]\ndef withRef [Monad m] [MonadRef m] {α} (ref : Syntax) (x : m α) : m α :=\n bind getRef fun oldRef =>\n let ref := replaceRef ref oldRef\n MonadRef.withRef ref x",
"start": [
4158,
1
],
"end": [
4167,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MonadQuotation",
"code": "class MonadQuotation (m : Type → Type) extends MonadRef m where\n \n getCurrMacroScope : m MacroScope\n \n getMainModule : m Name\n \n withFreshMacroScope {α : Type} : m α → m α",
"start": [
4169,
1
],
"end": [
4196,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MonadRef.mkInfoFromRefPos",
"code": "@[inline]\ndef MonadRef.mkInfoFromRefPos [Monad m] [MonadRef m] : m SourceInfo :=\n return SourceInfo.fromRef (← getRef)",
"start": [
4200,
1
],
"end": [
4203,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.hasMacroScopes",
"code": "def Name.hasMacroScopes : Name → Bool\n | str _ s => beq s \"_hyg\"\n | num p _ => hasMacroScopes p\n | _ => false",
"start": [
4231,
1
],
"end": [
4235,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.eraseMacroScopesAux",
"code": "private def eraseMacroScopesAux : Name → Name\n | .str p s => match beq s \"_@\" with\n | true => p\n | false => eraseMacroScopesAux p\n | .num p _ => eraseMacroScopesAux p\n | .anonymous => Name.anonymous",
"start": [
4237,
1
],
"end": [
4242,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.eraseMacroScopes",
"code": "@[export lean_erase_macro_scopes]\ndef Name.eraseMacroScopes (n : Name) : Name :=\n match n.hasMacroScopes with\n | true => eraseMacroScopesAux n\n | false => n",
"start": [
4244,
1
],
"end": [
4249,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.simpMacroScopesAux",
"code": "private def simpMacroScopesAux : Name → Name\n | .num p i => Name.mkNum (simpMacroScopesAux p) i\n | n => eraseMacroScopesAux n",
"start": [
4251,
1
],
"end": [
4253,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.simpMacroScopes",
"code": "@[export lean_simp_macro_scopes]\ndef Name.simpMacroScopes (n : Name) : Name :=\n match n.hasMacroScopes with\n | true => simpMacroScopesAux n\n | false => n",
"start": [
4255,
1
],
"end": [
4260,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MacroScopesView",
"code": "structure MacroScopesView where\n \n name : Name\n \n imported : Name\n \n mainModule : Name\n \n scopes : List MacroScope",
"start": [
4262,
1
],
"end": [
4279,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MacroScopesView.review",
"code": "def MacroScopesView.review (view : MacroScopesView) : Name :=\n match view.scopes with\n | List.nil => view.name\n | List.cons _ _ =>\n let base := (Name.mkStr (Name.appendCore (Name.appendCore (Name.mkStr view.name \"_@\") view.imported) view.mainModule) \"_hyg\")\n view.scopes.foldl Name.mkNum base",
"start": [
4284,
1
],
"end": [
4290,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.assembleParts",
"code": "private def assembleParts : List Name → Name → Name\n | .nil, acc => acc\n | .cons (.str _ s) ps, acc => assembleParts ps (Name.mkStr acc s)\n | .cons (.num _ n) ps, acc => assembleParts ps (Name.mkNum acc n)\n | _, _ => panic \"Error: unreachable @ assembleParts\"",
"start": [
4292,
1
],
"end": [
4296,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.extractImported",
"code": "private def extractImported (scps : List MacroScope) (mainModule : Name) : Name → List Name → MacroScopesView\n | n@(Name.str p str), parts =>\n match beq str \"_@\" with\n | true => { name := p, mainModule := mainModule, imported := assembleParts parts Name.anonymous, scopes := scps }\n | false => extractImported scps mainModule p (List.cons n parts)\n | n@(Name.num p _), parts => extractImported scps mainModule p (List.cons n parts)\n | _, _ => panic \"Error: unreachable @ extractImported\"",
"start": [
4298,
1
],
"end": [
4304,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.extractMainModule",
"code": "private def extractMainModule (scps : List MacroScope) : Name → List Name → MacroScopesView\n | n@(Name.str p str), parts =>\n match beq str \"_@\" with\n | true => { name := p, mainModule := assembleParts parts Name.anonymous, imported := Name.anonymous, scopes := scps }\n | false => extractMainModule scps p (List.cons n parts)\n | n@(Name.num _ _), acc => extractImported scps (assembleParts acc Name.anonymous) n List.nil\n | _, _ => panic \"Error: unreachable @ extractMainModule\"",
"start": [
4306,
1
],
"end": [
4312,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.extractMacroScopesAux",
"code": "private def extractMacroScopesAux : Name → List MacroScope → MacroScopesView\n | Name.num p scp, acc => extractMacroScopesAux p (List.cons scp acc)\n | Name.str p _ , acc => extractMainModule acc p List.nil | _, _ => panic \"Error: unreachable @ extractMacroScopesAux\"",
"start": [
4314,
1
],
"end": [
4317,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.extractMacroScopes",
"code": "def extractMacroScopes (n : Name) : MacroScopesView :=\n match n.hasMacroScopes with\n | true => extractMacroScopesAux n List.nil\n | false => { name := n, scopes := List.nil, imported := Name.anonymous, mainModule := Name.anonymous }",
"start": [
4319,
1
],
"end": [
4326,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.addMacroScope",
"code": "def addMacroScope (mainModule : Name) (n : Name) (scp : MacroScope) : Name :=\n match n.hasMacroScopes with\n | true =>\n let view := extractMacroScopes n\n match beq view.mainModule mainModule with\n | true => Name.mkNum n scp\n | false =>\n { view with\n imported := view.scopes.foldl Name.mkNum (Name.appendCore view.imported view.mainModule)\n mainModule := mainModule\n scopes := List.cons scp List.nil\n }.review\n | false =>\n Name.mkNum (Name.mkStr (Name.appendCore (Name.mkStr n \"_@\") mainModule) \"_hyg\") scp",
"start": [
4328,
1
],
"end": [
4342,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.append",
"code": "def Name.append (a b : Name) : Name :=\n match a.hasMacroScopes, b.hasMacroScopes with\n | true, true =>\n panic \"Error: invalid `Name.append`, both arguments have macro scopes, consider using `eraseMacroScopes`\"\n | true, false =>\n let view := extractMacroScopes a\n { view with name := appendCore view.name b }.review\n | false, true =>\n let view := extractMacroScopes b\n { view with name := appendCore a view.name }.review\n | false, false => appendCore a b",
"start": [
4344,
1
],
"end": [
4363,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MonadQuotation.addMacroScope",
"code": "@[inline] def MonadQuotation.addMacroScope {m : Type → Type} [MonadQuotation m] [Monad m] (n : Name) : m Name :=\n bind getMainModule fun mainModule =>\n bind getCurrMacroScope fun scp =>\n pure (Lean.addMacroScope mainModule n scp)",
"start": [
4368,
1
],
"end": [
4375,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.defaultMaxRecDepth",
"code": "def defaultMaxRecDepth := 512",
"start": [
4377,
1
],
"end": [
4378,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.maxRecDepthErrorMessage",
"code": "def maxRecDepthErrorMessage : String :=\n \"maximum recursion depth has been reached\\nuse `set_option maxRecDepth <num>` to increase limit\\nuse `set_option diagnostics true` to get diagnostic information\"",
"start": [
4380,
1
],
"end": [
4382,
164
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.matchesNull",
"code": "def matchesNull (stx : Syntax) (n : Nat) : Bool :=\n stx.isNodeOf nullKind n",
"start": [
4386,
1
],
"end": [
4388,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.matchesIdent",
"code": "def matchesIdent (stx : Syntax) (id : Name) : Bool :=\n and stx.isIdent (beq stx.getId.eraseMacroScopes id.eraseMacroScopes)",
"start": [
4390,
1
],
"end": [
4399,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.matchesLit",
"code": "def matchesLit (stx : Syntax) (k : SyntaxNodeKind) (val : String) : Bool :=\n match stx with\n | Syntax.node _ k' args => and (beq k k') (match args.getD 0 Syntax.missing with\n | Syntax.atom _ val' => beq val val'\n | _ => false)\n | _ => false",
"start": [
4401,
1
],
"end": [
4407,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.MethodsRefPointed",
"code": "private opaque MethodsRefPointed : NonemptyType.{0}",
"start": [
4413,
1
],
"end": [
4414,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.MethodsRef",
"code": "private def MethodsRef : Type := MethodsRefPointed.type",
"start": [
4416,
1
],
"end": [
4416,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.Context",
"code": "structure Context where\n \n methods : MethodsRef\n \n mainModule : Name\n \n currMacroScope : MacroScope\n \n currRecDepth : Nat := 0\n \n maxRecDepth : Nat := defaultMaxRecDepth\n \n ref : Syntax",
"start": [
4420,
1
],
"end": [
4434,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.Exception",
"code": "inductive Exception where\n \n | error : Syntax → String → Exception\n \n | unsupportedSyntax : Exception",
"start": [
4436,
1
],
"end": [
4443,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.State",
"code": "structure State where\n \n macroScope : MacroScope\n \n traceMsgs : List (Prod Name String) := List.nil\n deriving Inhabited",
"start": [
4445,
1
],
"end": [
4452,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MacroM",
"code": "abbrev MacroM := ReaderT Macro.Context (EStateM Macro.Exception Macro.State)",
"start": [
4456,
1
],
"end": [
4466,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro",
"code": "abbrev Macro := Syntax → MacroM Syntax",
"start": [
4468,
1
],
"end": [
4473,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.addMacroScope",
"code": "def addMacroScope (n : Name) : MacroM Name :=\n bind read fun ctx =>\n pure (Lean.addMacroScope ctx.mainModule n ctx.currMacroScope)",
"start": [
4481,
1
],
"end": [
4484,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.throwUnsupported",
"code": "def throwUnsupported {α} : MacroM α :=\n throw Exception.unsupportedSyntax",
"start": [
4486,
1
],
"end": [
4488,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.throwError",
"code": "def throwError {α} (msg : String) : MacroM α :=\n bind getRef fun ref =>\n throw (Exception.error ref msg)",
"start": [
4490,
1
],
"end": [
4496,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.throwErrorAt",
"code": "def throwErrorAt {α} (ref : Syntax) (msg : String) : MacroM α :=\n withRef ref (throwError msg)",
"start": [
4498,
1
],
"end": [
4500,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.withFreshMacroScope",
"code": "@[inline] protected def withFreshMacroScope {α} (x : MacroM α) : MacroM α :=\n bind (modifyGet (fun s => (s.macroScope, { s with macroScope := hAdd s.macroScope 1 }))) fun fresh =>\n withReader (fun ctx => { ctx with currMacroScope := fresh }) x",
"start": [
4502,
1
],
"end": [
4508,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.withIncRecDepth",
"code": "@[inline] def withIncRecDepth {α} (ref : Syntax) (x : MacroM α) : MacroM α :=\n bind read fun ctx =>\n match beq ctx.currRecDepth ctx.maxRecDepth with\n | true => throw (Exception.error ref maxRecDepthErrorMessage)\n | false => withReader (fun ctx => { ctx with currRecDepth := hAdd ctx.currRecDepth 1 }) x",
"start": [
4510,
1
],
"end": [
4515,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.Methods",
"code": "structure Methods where\n \n expandMacro? : Syntax → MacroM (Option Syntax)\n \n getCurrNamespace : MacroM Name\n \n hasDecl : Name → MacroM Bool\n \n resolveNamespace : Name → MacroM (List Name)\n \n resolveGlobalName : Name → MacroM (List (Prod Name (List String)))\n deriving Inhabited",
"start": [
4522,
1
],
"end": [
4537,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.mkMethodsImp",
"code": "unsafe def mkMethodsImp (methods : Methods) : MethodsRef :=\n unsafeCast methods",
"start": [
4539,
1
],
"end": [
4541,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.mkMethods",
"code": "@[implemented_by mkMethodsImp]\nopaque mkMethods (methods : Methods) : MethodsRef",
"start": [
4543,
1
],
"end": [
4545,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.getMethodsImp",
"code": "unsafe def getMethodsImp : MacroM Methods :=\n bind read fun ctx => pure (unsafeCast (ctx.methods))",
"start": [
4550,
1
],
"end": [
4552,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.getMethods",
"code": "@[implemented_by getMethodsImp] opaque getMethods : MacroM Methods",
"start": [
4554,
1
],
"end": [
4555,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.expandMacro?",
"code": "def expandMacro? (stx : Syntax) : MacroM (Option Syntax) := do\n (← getMethods).expandMacro? stx",
"start": [
4557,
1
],
"end": [
4562,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.hasDecl",
"code": "def hasDecl (declName : Name) : MacroM Bool := do\n (← getMethods).hasDecl declName",
"start": [
4564,
1
],
"end": [
4566,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.getCurrNamespace",
"code": "def getCurrNamespace : MacroM Name := do\n (← getMethods).getCurrNamespace",
"start": [
4568,
1
],
"end": [
4570,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.resolveNamespace",
"code": "def resolveNamespace (n : Name) : MacroM (List Name) := do\n (← getMethods).resolveNamespace n",
"start": [
4572,
3
],
"end": [
4574,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.resolveGlobalName",
"code": "def resolveGlobalName (n : Name) : MacroM (List (Prod Name (List String))) := do\n (← getMethods).resolveGlobalName n",
"start": [
4576,
1
],
"end": [
4588,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Macro.trace",
"code": "def trace (clsName : Name) (msg : String) : MacroM Unit := do\n modify fun s => { s with traceMsgs := List.cons (Prod.mk clsName msg) s.traceMsgs }",
"start": [
4590,
1
],
"end": [
4592,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PrettyPrinter.UnexpandM",
"code": "abbrev UnexpandM := ReaderT Syntax (EStateM Unit Unit)",
"start": [
4600,
1
],
"end": [
4604,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PrettyPrinter.Unexpander",
"code": "abbrev Unexpander := Syntax → UnexpandM Syntax",
"start": [
4606,
1
],
"end": [
4612,
47
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Coe.lean | [
".lake/packages/lean4/src/lean/Init/Prelude.lean"
] | [
{
"full_name": "Coe",
"code": "class Coe (α : semiOutParam (Sort u)) (β : Sort v) where\n \n coe : α → β",
"start": [
120,
1
],
"end": [
129,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeTC",
"code": "class CoeTC (α : Sort u) (β : Sort v) where\n \n coe : α → β",
"start": [
132,
1
],
"end": [
139,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeOut",
"code": "class CoeOut (α : Sort u) (β : semiOutParam (Sort v)) where\n \n coe : α → β",
"start": [
146,
1
],
"end": [
152,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeOTC",
"code": "class CoeOTC (α : Sort u) (β : Sort v) where\n \n coe : α → β",
"start": [
155,
1
],
"end": [
162,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeHead",
"code": "class CoeHead (α : Sort u) (β : semiOutParam (Sort v)) where\n \n coe : α → β",
"start": [
173,
1
],
"end": [
180,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeHTC",
"code": "class CoeHTC (α : Sort u) (β : Sort v) where\n \n coe : α → β",
"start": [
183,
1
],
"end": [
190,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeTail",
"code": "class CoeTail (α : semiOutParam (Sort u)) (β : Sort v) where\n \n coe : α → β",
"start": [
197,
1
],
"end": [
205,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeHTCT",
"code": "class CoeHTCT (α : Sort u) (β : Sort v) where\n \n coe : α → β",
"start": [
208,
1
],
"end": [
215,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeDep",
"code": "class CoeDep (α : Sort u) (_ : α) (β : Sort v) where\n \n coe : β",
"start": [
222,
1
],
"end": [
234,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeT",
"code": "class CoeT (α : Sort u) (_ : α) (β : Sort v) where\n \n coe : β",
"start": [
237,
1
],
"end": [
248,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeFun",
"code": "class CoeFun (α : Sort u) (γ : outParam (α → Sort v)) where\n \n coe : (f : α) → γ f",
"start": [
255,
1
],
"end": [
266,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "CoeSort",
"code": "class CoeSort (α : Sort u) (β : outParam (Sort v)) where\n \n coe : α → β",
"start": [
271,
1
],
"end": [
279,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "boolToProp",
"code": "instance boolToProp : Coe Bool Prop where\n coe b := Eq b true",
"start": [
301,
1
],
"end": [
302,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "boolToSort",
"code": "instance boolToSort : CoeSort Bool Prop where\n coe b := b",
"start": [
304,
1
],
"end": [
305,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "decPropToBool",
"code": "instance decPropToBool (p : Prop) [Decidable p] : CoeDep Prop p Bool where\n coe := decide p",
"start": [
307,
1
],
"end": [
308,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "optionCoe",
"code": "instance optionCoe {α : Type u} : Coe α (Option α) where\n coe := some",
"start": [
310,
1
],
"end": [
311,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "subtypeCoe",
"code": "instance subtypeCoe {α : Sort u} {p : α → Prop} : CoeOut (Subtype p) α where\n coe v := v.val",
"start": [
313,
1
],
"end": [
314,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Internal.liftCoeM",
"code": "@[coe_decl] abbrev Lean.Internal.liftCoeM {m : Type u → Type v} {n : Type u → Type w} {α β : Type u}\n [MonadLiftT m n] [∀ a, CoeT α a β] [Monad n] (x : m α) : n β := do\n let a ← liftM x\n pure (CoeT.coe a)",
"start": [
318,
1
],
"end": [
327,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Internal.coeM",
"code": "@[coe_decl] abbrev Lean.Internal.coeM {m : Type u → Type v} {α β : Type u}\n [∀ a, CoeT α a β] [Monad m] (x : m α) : m β := do\n let a ← x\n pure (CoeT.coe a)",
"start": [
329,
1
],
"end": [
337,
20
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Notation.lean | [
".lake/packages/lean4/src/lean/Init/Coe.lean",
".lake/packages/lean4/src/lean/Init/Prelude.lean"
] | [
{
"full_name": "Lean.Parser.Category",
"code": "structure Parser.Category",
"start": [
15,
1
],
"end": [
19,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.command",
"code": "def command : Category := {}",
"start": [
23,
1
],
"end": [
28,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.term",
"code": "def term : Category := {}",
"start": [
30,
1
],
"end": [
35,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.tactic",
"code": "def tactic : Category := {}",
"start": [
37,
1
],
"end": [
45,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.doElem",
"code": "def doElem : Category := {}",
"start": [
47,
1
],
"end": [
49,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.level",
"code": "def level : Category := {}",
"start": [
51,
1
],
"end": [
54,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.attr",
"code": "def attr : Category := {}",
"start": [
56,
1
],
"end": [
58,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.stx",
"code": "def stx : Category := {}",
"start": [
60,
1
],
"end": [
62,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.prio",
"code": "def prio : Category := {}",
"start": [
64,
1
],
"end": [
70,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Category.prec",
"code": "def prec : Category := {}",
"start": [
72,
1
],
"end": [
81,
26
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Tactics.lean | [
".lake/packages/lean4/src/lean/Init/Notation.lean"
] | [
{
"full_name": "Lean.Parser.Tactic.simpArg",
"code": "def simpArg := simpStar.binary `orelse (simpErase.binary `orelse simpLemma)",
"start": [
588,
1
],
"end": [
592,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Parser.Tactic.dsimpArg",
"code": "def dsimpArg := simpErase.binary `orelse simpLemma",
"start": [
597,
1
],
"end": [
601,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "autoParam",
"code": "abbrev autoParam.{u} (α : Sort u) (tactic : Lean.Syntax) : Sort u := α",
"start": [
1609,
1
],
"end": [
1614,
71
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/SizeOf.lean | [
".lake/packages/lean4/src/lean/Init/Tactics.lean"
] | [
{
"full_name": "SizeOf",
"code": "class SizeOf (α : Sort u) where\n \n sizeOf : α → Nat",
"start": [
12,
1
],
"end": [
28,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "default.sizeOf",
"code": "protected def default.sizeOf (α : Sort u) : α → Nat\n | _ => 0",
"start": [
37,
1
],
"end": [
42,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "sizeOf_default",
"code": "@[simp] theorem sizeOf_default (n : α) : sizeOf n = 0",
"start": [
47,
1
],
"end": [
47,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "sizeOf_nat",
"code": "@[simp] theorem sizeOf_nat (n : Nat) : sizeOf n = n",
"start": [
52,
1
],
"end": [
52,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "sizeOf_thunk",
"code": "@[simp] theorem sizeOf_thunk [SizeOf α] (f : Unit → α) : sizeOf f = sizeOf (f ())",
"start": [
57,
1
],
"end": [
58,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Unit.sizeOf",
"code": "@[simp] theorem Unit.sizeOf (u : Unit) : sizeOf u = 1",
"start": [
85,
1
],
"end": [
85,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.sizeOf_eq_one",
"code": "@[simp] theorem Bool.sizeOf_eq_one (b : Bool) : sizeOf b = 1",
"start": [
86,
1
],
"end": [
86,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.sizeOf",
"code": "protected noncomputable def Name.sizeOf : Name → Nat\n | anonymous => 1\n | str p s => 1 + Name.sizeOf p + sizeOf s\n | num p n => 1 + Name.sizeOf p + sizeOf n",
"start": [
90,
1
],
"end": [
97,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.anonymous.sizeOf_spec",
"code": "@[simp] theorem Name.anonymous.sizeOf_spec : sizeOf anonymous = 1",
"start": [
102,
1
],
"end": [
103,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.str.sizeOf_spec",
"code": "@[simp] theorem Name.str.sizeOf_spec (p : Name) (s : String) : sizeOf (str p s) = 1 + sizeOf p + sizeOf s",
"start": [
104,
1
],
"end": [
105,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.num.sizeOf_spec",
"code": "@[simp] theorem Name.num.sizeOf_spec (p : Name) (n : Nat) : sizeOf (num p n) = 1 + sizeOf p + sizeOf n",
"start": [
106,
1
],
"end": [
107,
6
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Core.lean | [
".lake/packages/lean4/src/lean/Init/Prelude.lean",
".lake/packages/lean4/src/lean/Init/SizeOf.lean"
] | [
{
"full_name": "inline",
"code": "@[simp] def inline {α : Sort u} (a : α) : α := a",
"start": [
15,
1
],
"end": [
20,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "id_def",
"code": "theorem id_def {α : Sort u} (a : α) : id a = a",
"start": [
22,
1
],
"end": [
22,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "flip",
"code": "@[inline] def flip {α : Sort u} {β : Sort v} {φ : Sort w} (f : α → β → φ) : β → α → φ :=\n fun b a => f a b",
"start": [
24,
1
],
"end": [
31,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Function.const_apply",
"code": "@[simp] theorem Function.const_apply {y : β} {x : α} : const α y x = y",
"start": [
33,
1
],
"end": [
33,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Function.comp_apply",
"code": "@[simp] theorem Function.comp_apply {f : β → δ} {g : α → β} {x : α} : comp f g x = f (g x)",
"start": [
35,
1
],
"end": [
35,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Function.comp_def",
"code": "theorem Function.comp_def {α β δ} (f : β → δ) (g : α → β) : f ∘ g = fun x => f (g x)",
"start": [
37,
1
],
"end": [
37,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Empty.elim",
"code": "@[macro_inline] def Empty.elim {C : Sort u} : Empty → C := Empty.rec",
"start": [
41,
1
],
"end": [
47,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "PEmpty.elim",
"code": "@[macro_inline] def PEmpty.elim {C : Sort _} : PEmpty → C := fun a => nomatch a",
"start": [
52,
1
],
"end": [
58,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk",
"code": "structure Thunk (α : Type u) : Type u where\n \n mk ::\n \n private fn : Unit → α",
"start": [
63,
1
],
"end": [
72,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk.pure",
"code": "@[extern \"lean_thunk_pure\"] protected def Thunk.pure (a : α) : Thunk α :=\n ⟨fun _ => a⟩",
"start": [
76,
1
],
"end": [
78,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk.get",
"code": "@[extern \"lean_thunk_get_own\"] protected def Thunk.get (x : @& Thunk α) : α :=\n x.fn ()",
"start": [
80,
1
],
"end": [
87,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk.map",
"code": "@[inline] protected def Thunk.map (f : α → β) (x : Thunk α) : Thunk β :=\n ⟨fun _ => f x.get⟩",
"start": [
89,
1
],
"end": [
91,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk.bind",
"code": "@[inline] protected def Thunk.bind (x : Thunk α) (f : α → Thunk β) : Thunk β :=\n ⟨fun _ => (f x.get).get⟩",
"start": [
92,
1
],
"end": [
94,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Thunk.sizeOf_eq",
"code": "@[simp] theorem Thunk.sizeOf_eq [SizeOf α] (a : Thunk α) : sizeOf a = 1 + sizeOf a.get",
"start": [
96,
1
],
"end": [
97,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "thunkCoe",
"code": "instance thunkCoe : CoeTail α (Thunk α) where\n coe a := ⟨fun _ => a⟩",
"start": [
99,
1
],
"end": [
101,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.ndrecOn",
"code": "abbrev Eq.ndrecOn.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} {b : α} (h : a = b) (m : motive a) : motive b :=\n Eq.ndrec m h",
"start": [
103,
1
],
"end": [
105,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff",
"code": "structure Iff (a b : Prop) : Prop where\n \n intro ::\n \n mp : a → b\n \n mpr : b → a",
"start": [
109,
1
],
"end": [
120,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Sum",
"code": "inductive Sum (α : Type u) (β : Type v) where\n \n | inl (val : α) : Sum α β\n \n | inr (val : β) : Sum α β",
"start": [
125,
1
],
"end": [
134,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "PSum",
"code": "inductive PSum (α : Sort u) (β : Sort v) where\n \n | inl (val : α) : PSum α β\n \n | inr (val : β) : PSum α β",
"start": [
138,
1
],
"end": [
153,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Sigma",
"code": "@[pp_using_anonymous_constructor]\nstructure Sigma {α : Type u} (β : α → Type v) where\n \n mk ::\n \n fst : α\n \n snd : β fst",
"start": [
161,
1
],
"end": [
177,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma",
"code": "@[pp_using_anonymous_constructor]\nstructure PSigma {α : Sort u} (β : α → Sort v) where\n \n mk ::\n \n fst : α\n \n snd : β fst",
"start": [
181,
1
],
"end": [
203,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists",
"code": "inductive Exists {α : Sort u} (p : α → Prop) : Prop where\n \n | intro (w : α) (h : p w) : Exists p",
"start": [
205,
1
],
"end": [
233,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "ForInStep",
"code": "inductive ForInStep (α : Type u) where\n \n | done : α → ForInStep α\n \n | yield : α → ForInStep α\n deriving Inhabited",
"start": [
235,
1
],
"end": [
253,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "ForIn",
"code": "class ForIn (m : Type u₁ → Type u₂) (ρ : Type u) (α : outParam (Type v)) where\n \n forIn {β} [Monad m] (x : ρ) (b : β) (f : α → β → m (ForInStep β)) : m β",
"start": [
255,
1
],
"end": [
282,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "ForIn'",
"code": "class ForIn' (m : Type u₁ → Type u₂) (ρ : Type u) (α : outParam (Type v)) (d : outParam $ Membership α ρ) where\n \n forIn' {β} [Monad m] (x : ρ) (b : β) (f : (a : α) → a ∈ x → β → m (ForInStep β)) : m β",
"start": [
286,
1
],
"end": [
298,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "DoResultPRBC",
"code": "inductive DoResultPRBC (α β σ : Type u) where\n \n | pure : α → σ → DoResultPRBC α β σ\n \n | return : β → σ → DoResultPRBC α β σ\n \n | break : σ → DoResultPRBC α β σ\n \n | continue : σ → DoResultPRBC α β σ",
"start": [
303,
1
],
"end": [
326,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "DoResultPR",
"code": "inductive DoResultPR (α β σ : Type u) where\n \n | pure : α → σ → DoResultPR α β σ\n \n | return : β → σ → DoResultPR α β σ",
"start": [
328,
1
],
"end": [
337,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "DoResultBC",
"code": "inductive DoResultBC (σ : Type u) where\n \n | break : σ → DoResultBC σ\n \n | continue : σ → DoResultBC σ",
"start": [
339,
1
],
"end": [
350,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "DoResultSBC",
"code": "inductive DoResultSBC (α σ : Type u) where\n \n | pureReturn : α → σ → DoResultSBC α σ\n \n | break : σ → DoResultSBC α σ\n \n | continue : σ → DoResultSBC α σ",
"start": [
352,
1
],
"end": [
369,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "HasEquiv",
"code": "class HasEquiv (α : Sort u) where\n \n Equiv : α → α → Sort v",
"start": [
371,
1
],
"end": [
375,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "HasSubset",
"code": "class HasSubset (α : Type u) where\n \n Subset : α → α → Prop",
"start": [
381,
1
],
"end": [
384,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "HasSSubset",
"code": "class HasSSubset (α : Type u) where\n \n SSubset : α → α → Prop",
"start": [
387,
1
],
"end": [
390,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Superset",
"code": "abbrev Superset [HasSubset α] (a b : α) := Subset b a",
"start": [
393,
1
],
"end": [
394,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "SSuperset",
"code": "abbrev SSuperset [HasSSubset α] (a b : α) := SSubset b a",
"start": [
396,
1
],
"end": [
397,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Union",
"code": "class Union (α : Type u) where\n \n union : α → α → α",
"start": [
399,
1
],
"end": [
402,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Inter",
"code": "class Inter (α : Type u) where\n \n inter : α → α → α",
"start": [
404,
1
],
"end": [
407,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "SDiff",
"code": "class SDiff (α : Type u) where\n \n sdiff : α → α → α",
"start": [
409,
1
],
"end": [
415,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "EmptyCollection",
"code": "class EmptyCollection (α : Type u) where\n \n emptyCollection : α",
"start": [
443,
1
],
"end": [
447,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Insert",
"code": "class Insert (α : outParam <| Type u) (γ : Type v) where\n \n insert : α → γ → γ",
"start": [
452,
1
],
"end": [
458,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Singleton",
"code": "class Singleton (α : outParam <| Type u) (β : Type v) where\n \n singleton : α → β",
"start": [
461,
1
],
"end": [
467,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulSingleton",
"code": "class LawfulSingleton (α : Type u) (β : Type v) [EmptyCollection β] [Insert α β] [Singleton α β] :\n Prop where\n \n insert_emptyc_eq (x : α) : (insert x ∅ : β) = singleton x",
"start": [
470,
1
],
"end": [
474,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Sep",
"code": "class Sep (α : outParam <| Type u) (γ : Type v) where\n \n sep : (α → Prop) → γ → γ",
"start": [
477,
1
],
"end": [
480,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Task",
"code": "structure Task (α : Type u) : Type u where\n \n pure ::\n \n get : α\n deriving Inhabited, Nonempty",
"start": [
482,
1
],
"end": [
496,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.Priority",
"code": "abbrev Priority := Nat",
"start": [
502,
1
],
"end": [
503,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.Priority.default",
"code": "def Priority.default : Priority := 0",
"start": [
505,
1
],
"end": [
506,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.Priority.max",
"code": "def Priority.max : Priority := 8",
"start": [
507,
1
],
"end": [
515,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.Priority.dedicated",
"code": "def Priority.dedicated : Priority := 9",
"start": [
516,
1
],
"end": [
522,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.spawn",
"code": "@[noinline, extern \"lean_task_spawn\"]\nprotected def spawn {α : Type u} (fn : Unit → α) (prio := Priority.default) : Task α :=\n ⟨fn ()⟩",
"start": [
525,
1
],
"end": [
533,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.map",
"code": "@[noinline, extern \"lean_task_map\"]\nprotected def map (f : α → β) (x : Task α) (prio := Priority.default) (sync := false) : Task β :=\n ⟨f x.get⟩",
"start": [
536,
1
],
"end": [
546,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Task.bind",
"code": "@[noinline, extern \"lean_task_bind\"]\nprotected def bind (x : Task α) (f : α → Task β) (prio := Priority.default) (sync := false) :\n Task β :=\n ⟨(f x.get).get⟩",
"start": [
549,
1
],
"end": [
561,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "NonScalar",
"code": "structure NonScalar where\n mk ::\n val : Nat",
"start": [
565,
1
],
"end": [
573,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "PNonScalar",
"code": "inductive PNonScalar : Type u where\n \n | mk (v : Nat) : PNonScalar",
"start": [
575,
1
],
"end": [
586,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_zero",
"code": "@[simp] protected theorem Nat.add_zero (n : Nat) : n + 0 = n",
"start": [
588,
1
],
"end": [
588,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "optParam_eq",
"code": "theorem optParam_eq (α : Sort u) (default : α) : optParam α default = α",
"start": [
590,
1
],
"end": [
590,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "strictOr",
"code": "@[extern \"lean_strict_or\"] def strictOr (b₁ b₂ : Bool) := b₁ || b₂",
"start": [
594,
1
],
"end": [
598,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "strictAnd",
"code": "@[extern \"lean_strict_and\"] def strictAnd (b₁ b₂ : Bool) := b₁ && b₂",
"start": [
600,
1
],
"end": [
604,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "bne",
"code": "@[inline] def bne {α : Type u} [BEq α] (a b : α) : Bool :=\n !(a == b)",
"start": [
606,
1
],
"end": [
614,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulBEq",
"code": "class LawfulBEq (α : Type u) [BEq α] : Prop where\n \n eq_of_beq : {a b : α} → a == b → a = b\n \n protected rfl : {a : α} → a == a",
"start": [
618,
1
],
"end": [
627,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "trivial",
"code": "@[inherit_doc True.intro] theorem trivial : True",
"start": [
645,
1
],
"end": [
645,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "mt",
"code": "theorem mt {a b : Prop} (h₁ : a → b) (h₂ : ¬b) : ¬a",
"start": [
647,
1
],
"end": [
648,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "not_false",
"code": "theorem not_false : ¬False",
"start": [
650,
1
],
"end": [
650,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "not_not_intro",
"code": "theorem not_not_intro {p : Prop} (h : p) : ¬ ¬ p",
"start": [
652,
1
],
"end": [
653,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "proof_irrel",
"code": "theorem proof_irrel {a : Prop} (h₁ h₂ : a) : h₁ = h₂",
"start": [
656,
1
],
"end": [
656,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.mp",
"code": "@[macro_inline] def Eq.mp {α β : Sort u} (h : α = β) (a : α) : β :=\n h ▸ a",
"start": [
658,
1
],
"end": [
666,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.mpr",
"code": "@[macro_inline] def Eq.mpr {α β : Sort u} (h : α = β) (b : β) : α :=\n h ▸ b",
"start": [
668,
1
],
"end": [
676,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.substr",
"code": "@[elab_as_elim]\ntheorem Eq.substr {α : Sort u} {p : α → Prop} {a b : α} (h₁ : b = a) (h₂ : p a) : p b",
"start": [
678,
1
],
"end": [
680,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "cast_eq",
"code": "@[simp] theorem cast_eq {α : Sort u} (h : α = α) (a : α) : cast h a = a",
"start": [
682,
1
],
"end": [
683,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Ne",
"code": "@[reducible] def Ne {α : Sort u} (a b : α) :=\n ¬(a = b)",
"start": [
685,
1
],
"end": [
690,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Ne.intro",
"code": "theorem Ne.intro (h : a = b → False) : a ≠ b",
"start": [
698,
1
],
"end": [
698,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Ne.elim",
"code": "theorem Ne.elim (h : a ≠ b) : a = b → False",
"start": [
700,
1
],
"end": [
700,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Ne.irrefl",
"code": "theorem Ne.irrefl (h : a ≠ a) : False",
"start": [
702,
1
],
"end": [
702,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Ne.symm",
"code": "theorem Ne.symm (h : a ≠ b) : b ≠ a",
"start": [
704,
1
],
"end": [
704,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_comm",
"code": "theorem ne_comm {α} {a b : α} : a ≠ b ↔ b ≠ a",
"start": [
706,
1
],
"end": [
706,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "false_of_ne",
"code": "theorem false_of_ne : a ≠ a → False",
"start": [
708,
1
],
"end": [
708,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_false_of_self",
"code": "theorem ne_false_of_self : p → p ≠ False",
"start": [
710,
1
],
"end": [
711,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_true_of_not",
"code": "theorem ne_true_of_not : ¬p → p ≠ True",
"start": [
713,
1
],
"end": [
716,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "true_ne_false",
"code": "theorem true_ne_false : ¬True = False",
"start": [
718,
1
],
"end": [
718,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "false_ne_true",
"code": "theorem false_ne_true : False ≠ True",
"start": [
719,
1
],
"end": [
719,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.of_not_eq_true",
"code": "theorem Bool.of_not_eq_true : {b : Bool} → ¬ (b = true) → b = false",
"start": [
723,
1
],
"end": [
725,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.of_not_eq_false",
"code": "theorem Bool.of_not_eq_false : {b : Bool} → ¬ (b = false) → b = true",
"start": [
727,
1
],
"end": [
729,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_of_beq_false",
"code": "theorem ne_of_beq_false [BEq α] [LawfulBEq α] {a b : α} (h : (a == b) = false) : a ≠ b",
"start": [
731,
1
],
"end": [
732,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "beq_false_of_ne",
"code": "theorem beq_false_of_ne [BEq α] [LawfulBEq α] {a b : α} (h : a ≠ b) : (a == b) = false",
"start": [
734,
1
],
"end": [
737,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.ndrec",
"code": "noncomputable def HEq.ndrec.{u1, u2} {α : Sort u2} {a : α} {motive : {β : Sort u2} → β → Sort u1} (m : motive a) {β : Sort u2} {b : β} (h : HEq a b) : motive b :=\n h.rec m",
"start": [
742,
1
],
"end": [
744,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.ndrecOn",
"code": "noncomputable def HEq.ndrecOn.{u1, u2} {α : Sort u2} {a : α} {motive : {β : Sort u2} → β → Sort u1} {β : Sort u2} {b : β} (h : HEq a b) (m : motive a) : motive b :=\n h.rec m",
"start": [
746,
1
],
"end": [
748,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.elim",
"code": "noncomputable def HEq.elim {α : Sort u} {a : α} {p : α → Sort v} {b : α} (h₁ : HEq a b) (h₂ : p a) : p b :=\n eq_of_heq h₁ ▸ h₂",
"start": [
750,
1
],
"end": [
752,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.subst",
"code": "theorem HEq.subst {p : (T : Sort u) → T → Prop} (h₁ : HEq a b) (h₂ : p α a) : p β b",
"start": [
754,
1
],
"end": [
755,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.symm",
"code": "theorem HEq.symm (h : HEq a b) : HEq b a",
"start": [
757,
1
],
"end": [
758,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_of_eq",
"code": "theorem heq_of_eq (h : a = a') : HEq a a'",
"start": [
760,
1
],
"end": [
761,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "HEq.trans",
"code": "theorem HEq.trans (h₁ : HEq a b) (h₂ : HEq b c) : HEq a c",
"start": [
763,
1
],
"end": [
764,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_of_heq_of_eq",
"code": "theorem heq_of_heq_of_eq (h₁ : HEq a b) (h₂ : b = b') : HEq a b'",
"start": [
766,
1
],
"end": [
767,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_of_eq_of_heq",
"code": "theorem heq_of_eq_of_heq (h₁ : a = a') (h₂ : HEq a' b) : HEq a b",
"start": [
769,
1
],
"end": [
770,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "type_eq_of_heq",
"code": "theorem type_eq_of_heq (h : HEq a b) : α = β",
"start": [
772,
1
],
"end": [
773,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "eqRec_heq",
"code": "theorem eqRec_heq {α : Sort u} {φ : α → Sort v} {a a' : α} : (h : a = a') → (p : φ a) → HEq (Eq.recOn (motive := fun x _ => φ x) h p) p",
"start": [
777,
1
],
"end": [
778,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_of_eqRec_eq",
"code": "theorem heq_of_eqRec_eq {α β : Sort u} {a : α} {b : β} (h₁ : α = β) (h₂ : Eq.rec (motive := fun α _ => α) a h₁ = b) : HEq a b",
"start": [
780,
1
],
"end": [
783,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "cast_heq",
"code": "theorem cast_heq {α β : Sort u} : (h : α = β) → (a : α) → HEq (cast h a) a",
"start": [
785,
1
],
"end": [
786,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_iff_implies_and_implies",
"code": "theorem iff_iff_implies_and_implies (a b : Prop) : (a ↔ b) ↔ (a → b) ∧ (b → a)",
"start": [
790,
1
],
"end": [
791,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.refl",
"code": "theorem Iff.refl (a : Prop) : a ↔ a",
"start": [
793,
1
],
"end": [
794,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.rfl",
"code": "protected theorem Iff.rfl {a : Prop} : a ↔ a",
"start": [
796,
1
],
"end": [
797,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.of_eq",
"code": "theorem Iff.of_eq (h : a = b) : a ↔ b",
"start": [
801,
1
],
"end": [
801,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.trans",
"code": "theorem Iff.trans (h₁ : a ↔ b) (h₂ : b ↔ c) : a ↔ c",
"start": [
803,
1
],
"end": [
804,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.comm",
"code": "theorem Eq.comm {a b : α} : a = b ↔ b = a",
"start": [
810,
1
],
"end": [
810,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_comm",
"code": "theorem eq_comm {a b : α} : a = b ↔ b = a",
"start": [
811,
1
],
"end": [
811,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.symm",
"code": "theorem Iff.symm (h : a ↔ b) : b ↔ a",
"start": [
813,
1
],
"end": [
813,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.comm",
"code": "theorem Iff.comm: (a ↔ b) ↔ (b ↔ a)",
"start": [
814,
1
],
"end": [
814,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_comm",
"code": "theorem iff_comm : (a ↔ b) ↔ (b ↔ a)",
"start": [
815,
1
],
"end": [
815,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "And.symm",
"code": "theorem And.symm : a ∧ b → b ∧ a",
"start": [
817,
1
],
"end": [
817,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "And.comm",
"code": "theorem And.comm : a ∧ b ↔ b ∧ a",
"start": [
818,
1
],
"end": [
818,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "and_comm",
"code": "theorem and_comm : a ∧ b ↔ b ∧ a",
"start": [
819,
1
],
"end": [
819,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.symm",
"code": "theorem Or.symm : a ∨ b → b ∨ a",
"start": [
821,
1
],
"end": [
821,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.comm",
"code": "theorem Or.comm : a ∨ b ↔ b ∨ a",
"start": [
822,
1
],
"end": [
822,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "or_comm",
"code": "theorem or_comm : a ∨ b ↔ b ∨ a",
"start": [
823,
1
],
"end": [
823,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.elim",
"code": "theorem Exists.elim {α : Sort u} {p : α → Prop} {b : Prop}\n (h₁ : Exists (fun x => p x)) (h₂ : ∀ (a : α), p a → b) : b",
"start": [
827,
1
],
"end": [
830,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_true_eq_true",
"code": "theorem decide_true_eq_true (h : Decidable True) : @decide True h = true",
"start": [
834,
1
],
"end": [
837,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_false_eq_false",
"code": "theorem decide_false_eq_false (h : Decidable False) : @decide False h = false",
"start": [
839,
1
],
"end": [
842,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "toBoolUsing",
"code": "@[inline] def toBoolUsing {p : Prop} (d : Decidable p) : Bool :=\n decide (h := d)",
"start": [
844,
1
],
"end": [
846,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "toBoolUsing_eq_true",
"code": "theorem toBoolUsing_eq_true {p : Prop} (d : Decidable p) (h : p) : toBoolUsing d = true",
"start": [
848,
1
],
"end": [
849,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "ofBoolUsing_eq_true",
"code": "theorem ofBoolUsing_eq_true {p : Prop} {d : Decidable p} (h : toBoolUsing d = true) : p",
"start": [
851,
1
],
"end": [
852,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "ofBoolUsing_eq_false",
"code": "theorem ofBoolUsing_eq_false {p : Prop} {d : Decidable p} (h : toBoolUsing d = false) : ¬ p",
"start": [
854,
1
],
"end": [
855,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.byCases",
"code": "@[macro_inline] def byCases {q : Sort u} [dec : Decidable p] (h1 : p → q) (h2 : ¬p → q) : q :=\n match dec with\n | isTrue h => h1 h\n | isFalse h => h2 h",
"start": [
866,
1
],
"end": [
874,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.em",
"code": "theorem em (p : Prop) [Decidable p] : p ∨ ¬p",
"start": [
876,
1
],
"end": [
877,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.byContradiction",
"code": "theorem byContradiction [dec : Decidable p] (h : ¬p → False) : p",
"start": [
880,
1
],
"end": [
881,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.of_not_not",
"code": "theorem of_not_not [Decidable p] : ¬ ¬ p → p",
"start": [
883,
1
],
"end": [
884,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_and_iff_or_not",
"code": "theorem not_and_iff_or_not (p q : Prop) [d₁ : Decidable p] [d₂ : Decidable q] : ¬ (p ∧ q) ↔ ¬ p ∨ ¬ q",
"start": [
886,
1
],
"end": [
894,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "decidable_of_decidable_of_iff",
"code": "@[inline] def decidable_of_decidable_of_iff [Decidable p] (h : p ↔ q) : Decidable q :=\n if hp : p then\n isTrue (Iff.mp h hp)\n else\n isFalse fun hq => absurd (Iff.mpr h hq) hp",
"start": [
900,
1
],
"end": [
905,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "decidable_of_decidable_of_eq",
"code": "@[inline] def decidable_of_decidable_of_eq [Decidable p] (h : p = q) : Decidable q :=\n decidable_of_decidable_of_iff (p := p) (h ▸ Iff.rfl)",
"start": [
907,
1
],
"end": [
909,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "if_pos",
"code": "theorem if_pos {c : Prop} {h : Decidable c} (hc : c) {α : Sort u} {t e : α} : (ite c t e) = t",
"start": [
932,
1
],
"end": [
935,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "if_neg",
"code": "theorem if_neg {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t e : α} : (ite c t e) = e",
"start": [
937,
1
],
"end": [
940,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "iteInduction",
"code": "def iteInduction {c} [inst : Decidable c] {motive : α → Sort _} {t e : α}\n (hpos : c → motive t) (hneg : ¬c → motive e) : motive (ite c t e) :=\n match inst with\n | isTrue h => hpos h\n | isFalse h => hneg h",
"start": [
942,
1
],
"end": [
947,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "dif_pos",
"code": "theorem dif_pos {c : Prop} {h : Decidable c} (hc : c) {α : Sort u} {t : c → α} {e : ¬ c → α} : (dite c t e) = t hc",
"start": [
949,
1
],
"end": [
952,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "dif_neg",
"code": "theorem dif_neg {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t : c → α} {e : ¬ c → α} : (dite c t e) = e hnc",
"start": [
954,
1
],
"end": [
957,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "dif_eq_if",
"code": "theorem dif_eq_if (c : Prop) {h : Decidable c} {α : Sort u} (t : α) (e : α) : dite c (fun _ => t) (fun _ => e) = ite c t e",
"start": [
960,
1
],
"end": [
963,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "noConfusionTypeEnum",
"code": "abbrev noConfusionTypeEnum {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β) (P : Sort w) (x y : α) : Sort w :=\n (inst (f x) (f y)).casesOn\n (fun _ => P)\n (fun _ => P → P)",
"start": [
975,
1
],
"end": [
979,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "noConfusionEnum",
"code": "abbrev noConfusionEnum {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β) {P : Sort w} {x y : α} (h : x = y) : noConfusionTypeEnum f P x y :=\n Decidable.casesOn\n (motive := fun (inst : Decidable (f x = f y)) => Decidable.casesOn (motive := fun _ => Sort w) inst (fun _ => P) (fun _ => P → P))\n (inst (f x) (f y))\n (fun h' => False.elim (h' (congrArg f h)))\n (fun _ => fun x => x)",
"start": [
981,
1
],
"end": [
987,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "nonempty_of_exists",
"code": "theorem nonempty_of_exists {α : Sort u} {p : α → Prop} : Exists (fun x => p x) → Nonempty α",
"start": [
996,
1
],
"end": [
997,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Subsingleton",
"code": "class Subsingleton (α : Sort u) : Prop where\n \n intro ::\n \n allEq : (a b : α) → a = b",
"start": [
1001,
1
],
"end": [
1013,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Subsingleton.elim",
"code": "protected theorem Subsingleton.elim {α : Sort u} [h : Subsingleton α] : (a b : α) → a = b",
"start": [
1015,
1
],
"end": [
1016,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Subsingleton.helim",
"code": "protected theorem Subsingleton.helim {α β : Sort u} [h₁ : Subsingleton α] (h₂ : α = β) (a : α) (b : β) : HEq a b",
"start": [
1018,
1
],
"end": [
1021,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "recSubsingleton",
"code": "theorem recSubsingleton\n {p : Prop} [h : Decidable p]\n {h₁ : p → Sort u}\n {h₂ : ¬p → Sort u}\n [h₃ : ∀ (h : p), Subsingleton (h₁ h)]\n [h₄ : ∀ (h : ¬p), Subsingleton (h₂ h)]\n : Subsingleton (h.casesOn h₂ h₁)",
"start": [
1043,
1
],
"end": [
1052,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Equivalence",
"code": "structure Equivalence {α : Sort u} (r : α → α → Prop) : Prop where\n \n refl : ∀ x, r x x\n \n symm : ∀ {x y}, r x y → r y x\n \n trans : ∀ {x y z}, r x y → r y z → r x z",
"start": [
1054,
1
],
"end": [
1071,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "emptyRelation",
"code": "def emptyRelation {α : Sort u} (_ _ : α) : Prop :=\n False",
"start": [
1073,
1
],
"end": [
1075,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Subrelation",
"code": "def Subrelation {α : Sort u} (q r : α → α → Prop) :=\n ∀ {x y}, q x y → r x y",
"start": [
1077,
1
],
"end": [
1082,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "InvImage",
"code": "def InvImage {α : Sort u} {β : Sort v} (r : β → β → Prop) (f : α → β) : α → α → Prop :=\n fun a₁ a₂ => r (f a₁) (f a₂)",
"start": [
1084,
1
],
"end": [
1089,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "TC",
"code": "inductive TC {α : Sort u} (r : α → α → Prop) : α → α → Prop where\n \n | base : ∀ a b, r a b → TC r a b\n \n | trans : ∀ a b c, TC r a b → TC r b c → TC r a c",
"start": [
1091,
1
],
"end": [
1100,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Subtype.existsOfSubtype",
"code": "theorem existsOfSubtype {α : Type u} {p : α → Prop} : { x // p x } → Exists (fun x => p x)",
"start": [
1105,
1
],
"end": [
1106,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Subtype.eq",
"code": "protected theorem eq : ∀ {a1 a2 : {x // p x}}, val a1 = val a2 → a1 = a2",
"start": [
1110,
1
],
"end": [
1111,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Subtype.eta",
"code": "theorem eta (a : {x // p x}) (h : p (val a)) : mk (val a) h = a",
"start": [
1113,
1
],
"end": [
1115,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Sum.inhabitedLeft",
"code": "instance Sum.inhabitedLeft [Inhabited α] : Inhabited (Sum α β) where\n default := Sum.inl default",
"start": [
1129,
1
],
"end": [
1130,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Sum.inhabitedRight",
"code": "instance Sum.inhabitedRight [Inhabited β] : Inhabited (Sum α β) where\n default := Sum.inr default",
"start": [
1132,
1
],
"end": [
1133,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lexLt",
"code": "def Prod.lexLt [LT α] [LT β] (s : α × β) (t : α × β) : Prop :=\n s.1 < t.1 ∨ (s.1 = t.1 ∧ s.2 < t.2)",
"start": [
1171,
1
],
"end": [
1173,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lexLtDec",
"code": "instance Prod.lexLtDec\n [LT α] [LT β] [DecidableEq α]\n [(a b : α) → Decidable (a < b)] [(a b : β) → Decidable (a < b)]\n : (s t : α × β) → Decidable (Prod.lexLt s t) :=\n fun _ _ => inferInstanceAs (Decidable (_ ∨ _))",
"start": [
1175,
1
],
"end": [
1179,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lexLt_def",
"code": "theorem Prod.lexLt_def [LT α] [LT β] (s t : α × β) : (Prod.lexLt s t) = (s.1 < t.1 ∨ (s.1 = t.1 ∧ s.2 < t.2))",
"start": [
1181,
1
],
"end": [
1182,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.eta",
"code": "theorem Prod.eta (p : α × β) : (p.1, p.2) = p",
"start": [
1184,
1
],
"end": [
1184,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.map",
"code": "def Prod.map {α₁ : Type u₁} {α₂ : Type u₂} {β₁ : Type v₁} {β₂ : Type v₂}\n (f : α₁ → α₂) (g : β₁ → β₂) : α₁ × β₁ → α₂ × β₂\n | (a, b) => (f a, g b)",
"start": [
1186,
1
],
"end": [
1192,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.map_apply",
"code": "@[simp] theorem Prod.map_apply (f : α → β) (g : γ → δ) (x) (y) :\n Prod.map f g (x, y) = (f x, g y)",
"start": [
1194,
1
],
"end": [
1195,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.map_fst",
"code": "@[simp] theorem Prod.map_fst (f : α → β) (g : γ → δ) (x) : (Prod.map f g x).1 = f x.1",
"start": [
1196,
1
],
"end": [
1196,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.map_snd",
"code": "@[simp] theorem Prod.map_snd (f : α → β) (g : γ → δ) (x) : (Prod.map f g x).2 = g x.2",
"start": [
1197,
1
],
"end": [
1197,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "ex_of_PSigma",
"code": "theorem ex_of_PSigma {α : Type u} {p : α → Prop} : (PSigma (fun x => p x)) → Exists (fun x => p x)",
"start": [
1201,
1
],
"end": [
1202,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.eta",
"code": "protected theorem PSigma.eta {α : Sort u} {β : α → Sort v} {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂}\n (h₁ : a₁ = a₂) (h₂ : Eq.ndrec b₁ h₁ = b₂) : PSigma.mk a₁ b₁ = PSigma.mk a₂ b₂",
"start": [
1204,
1
],
"end": [
1208,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "PUnit.subsingleton",
"code": "theorem PUnit.subsingleton (a b : PUnit) : a = b",
"start": [
1212,
1
],
"end": [
1213,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "PUnit.eq_punit",
"code": "theorem PUnit.eq_punit (a : PUnit) : a = ⟨⟩",
"start": [
1215,
1
],
"end": [
1216,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Setoid",
"code": "class Setoid (α : Sort u) where\n \n r : α → α → Prop\n \n iseqv : Equivalence r",
"start": [
1229,
1
],
"end": [
1237,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Setoid.refl",
"code": "theorem refl (a : α) : a ≈ a",
"start": [
1246,
1
],
"end": [
1247,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Setoid.symm",
"code": "theorem symm {a b : α} (hab : a ≈ b) : b ≈ a",
"start": [
1249,
1
],
"end": [
1250,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Setoid.trans",
"code": "theorem trans {a b c : α} (hab : a ≈ b) (hbc : b ≈ c) : a ≈ c",
"start": [
1252,
1
],
"end": [
1253,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "propext",
"code": "axiom propext {a b : Prop} : (a ↔ b) → a = b",
"start": [
1260,
1
],
"end": [
1294,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.propIntro",
"code": "theorem Eq.propIntro {a b : Prop} (h₁ : a → b) (h₂ : b → a) : a = b",
"start": [
1296,
1
],
"end": [
1297,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ.inj",
"code": "theorem Nat.succ.inj {m n : Nat} : m.succ = n.succ → m = n",
"start": [
1320,
1
],
"end": [
1321,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ.injEq",
"code": "theorem Nat.succ.injEq (u v : Nat) : (u.succ = v.succ) = (u = v)",
"start": [
1323,
1
],
"end": [
1324,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "beq_iff_eq",
"code": "@[simp] theorem beq_iff_eq [BEq α] [LawfulBEq α] (a b : α) : a == b ↔ a = b",
"start": [
1326,
1
],
"end": [
1327,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Not.elim",
"code": "def Not.elim {α : Sort _} (H1 : ¬a) (H2 : a) : α := absurd H2 H1",
"start": [
1331,
1
],
"end": [
1333,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "And.elim",
"code": "abbrev And.elim (f : a → b → α) (h : a ∧ b) : α := f h.left h.right",
"start": [
1335,
1
],
"end": [
1336,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.elim",
"code": "def Iff.elim (f : (a → b) → (b → a) → α) (h : a ↔ b) : α := f h.mp h.mpr",
"start": [
1338,
1
],
"end": [
1339,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Iff.subst",
"code": "theorem Iff.subst {a b : Prop} {p : Prop → Prop} (h₁ : a ↔ b) (h₂ : p a) : p b",
"start": [
1341,
1
],
"end": [
1343,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Not.intro",
"code": "theorem Not.intro {a : Prop} (h : a → False) : ¬a",
"start": [
1345,
1
],
"end": [
1345,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Not.imp",
"code": "theorem Not.imp {a b : Prop} (H2 : ¬b) (H1 : a → b) : ¬a",
"start": [
1347,
1
],
"end": [
1347,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "not_congr",
"code": "theorem not_congr (h : a ↔ b) : ¬a ↔ ¬b",
"start": [
1349,
1
],
"end": [
1349,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "not_not_not",
"code": "theorem not_not_not : ¬¬¬a ↔ ¬a",
"start": [
1351,
1
],
"end": [
1351,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_of_true",
"code": "theorem iff_of_true (ha : a) (hb : b) : a ↔ b",
"start": [
1353,
1
],
"end": [
1353,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_of_false",
"code": "theorem iff_of_false (ha : ¬a) (hb : ¬b) : a ↔ b",
"start": [
1354,
1
],
"end": [
1354,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_true_left",
"code": "theorem iff_true_left (ha : a) : (a ↔ b) ↔ b",
"start": [
1356,
1
],
"end": [
1356,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_true_right",
"code": "theorem iff_true_right (ha : a) : (b ↔ a) ↔ b",
"start": [
1357,
1
],
"end": [
1357,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_false_left",
"code": "theorem iff_false_left (ha : ¬a) : (a ↔ b) ↔ ¬b",
"start": [
1359,
1
],
"end": [
1359,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_false_right",
"code": "theorem iff_false_right (ha : ¬a) : (b ↔ a) ↔ ¬b",
"start": [
1360,
1
],
"end": [
1360,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "of_iff_true",
"code": "theorem of_iff_true (h : a ↔ True) : a",
"start": [
1362,
1
],
"end": [
1362,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_true_intro",
"code": "theorem iff_true_intro (h : a) : a ↔ True",
"start": [
1363,
1
],
"end": [
1363,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "not_of_iff_false",
"code": "theorem not_of_iff_false : (p ↔ False) → ¬p",
"start": [
1365,
1
],
"end": [
1365,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_false_intro",
"code": "theorem iff_false_intro (h : ¬a) : a ↔ False",
"start": [
1366,
1
],
"end": [
1366,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "not_iff_false_intro",
"code": "theorem not_iff_false_intro (h : a) : ¬a ↔ False",
"start": [
1368,
1
],
"end": [
1368,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "not_true",
"code": "theorem not_true : (¬True) ↔ False",
"start": [
1369,
1
],
"end": [
1369,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "not_false_iff",
"code": "theorem not_false_iff : (¬False) ↔ True",
"start": [
1371,
1
],
"end": [
1371,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.to_iff",
"code": "theorem Eq.to_iff : a = b → (a ↔ b)",
"start": [
1373,
1
],
"end": [
1373,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_of_eq",
"code": "theorem iff_of_eq : a = b → (a ↔ b)",
"start": [
1374,
1
],
"end": [
1374,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "neq_of_not_iff",
"code": "theorem neq_of_not_iff : ¬(a ↔ b) → a ≠ b",
"start": [
1375,
1
],
"end": [
1375,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_iff_eq",
"code": "theorem iff_iff_eq : (a ↔ b) ↔ a = b",
"start": [
1377,
1
],
"end": [
1377,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_iff_iff",
"code": "@[simp] theorem eq_iff_iff : (a = b) ↔ (a ↔ b)",
"start": [
1378,
1
],
"end": [
1378,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_self_iff_true",
"code": "theorem eq_self_iff_true (a : α) : a = a ↔ True",
"start": [
1380,
1
],
"end": [
1380,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_self_iff_false",
"code": "theorem ne_self_iff_false (a : α) : a ≠ a ↔ False",
"start": [
1381,
1
],
"end": [
1381,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "false_of_true_iff_false",
"code": "theorem false_of_true_iff_false (h : True ↔ False) : False",
"start": [
1383,
1
],
"end": [
1383,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "false_of_true_eq_false",
"code": "theorem false_of_true_eq_false (h : True = False) : False",
"start": [
1384,
1
],
"end": [
1384,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "true_eq_false_of_false",
"code": "theorem true_eq_false_of_false : False → (True = False)",
"start": [
1386,
1
],
"end": [
1386,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_def",
"code": "theorem iff_def : (a ↔ b) ↔ (a → b) ∧ (b → a)",
"start": [
1388,
1
],
"end": [
1388,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_def'",
"code": "theorem iff_def' : (a ↔ b) ↔ (b → a) ∧ (a → b)",
"start": [
1389,
1
],
"end": [
1389,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "true_iff_false",
"code": "theorem true_iff_false : (True ↔ False) ↔ False",
"start": [
1391,
1
],
"end": [
1391,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "false_iff_true",
"code": "theorem false_iff_true : (False ↔ True) ↔ False",
"start": [
1392,
1
],
"end": [
1392,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_not_self",
"code": "theorem iff_not_self : ¬(a ↔ ¬a)",
"start": [
1394,
1
],
"end": [
1394,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_self_iff_true",
"code": "theorem heq_self_iff_true (a : α) : HEq a a ↔ True",
"start": [
1395,
1
],
"end": [
1395,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "not_not_of_not_imp",
"code": "theorem not_not_of_not_imp : ¬(a → b) → ¬¬a",
"start": [
1399,
1
],
"end": [
1399,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "not_of_not_imp",
"code": "theorem not_of_not_imp {a : Prop} : ¬(a → b) → ¬b",
"start": [
1401,
1
],
"end": [
1401,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_not_self",
"code": "@[simp] theorem imp_not_self : (a → ¬a) ↔ ¬a",
"start": [
1403,
1
],
"end": [
1403,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_intro",
"code": "theorem imp_intro {α β : Prop} (h : α) : β → α",
"start": [
1405,
1
],
"end": [
1405,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_imp_imp",
"code": "theorem imp_imp_imp {a b c d : Prop} (h₀ : c → a) (h₁ : b → d) : (a → b) → (c → d)",
"start": [
1407,
1
],
"end": [
1407,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_iff_right",
"code": "theorem imp_iff_right {a : Prop} (ha : a) : (a → b) ↔ b",
"start": [
1409,
1
],
"end": [
1409,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_true_iff",
"code": "theorem imp_true_iff (α : Sort u) : (α → True) ↔ True",
"start": [
1412,
1
],
"end": [
1412,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "false_imp_iff",
"code": "theorem false_imp_iff (a : Prop) : (False → a) ↔ True",
"start": [
1414,
1
],
"end": [
1414,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "true_imp_iff",
"code": "theorem true_imp_iff (α : Prop) : (True → α) ↔ α",
"start": [
1416,
1
],
"end": [
1416,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_self",
"code": "@[simp high] theorem imp_self : (a → a) ↔ True",
"start": [
1418,
1
],
"end": [
1418,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_false",
"code": "@[simp] theorem imp_false : (a → False) ↔ ¬a",
"start": [
1420,
1
],
"end": [
1420,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "imp.swap",
"code": "theorem imp.swap : (a → b → c) ↔ (b → a → c)",
"start": [
1422,
1
],
"end": [
1422,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_not_comm",
"code": "theorem imp_not_comm : (a → ¬b) ↔ (b → ¬a)",
"start": [
1424,
1
],
"end": [
1424,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_congr_left",
"code": "theorem imp_congr_left (h : a ↔ b) : (a → c) ↔ (b → c)",
"start": [
1426,
1
],
"end": [
1426,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_congr_right",
"code": "theorem imp_congr_right (h : a → (b ↔ c)) : (a → b) ↔ (a → c)",
"start": [
1428,
1
],
"end": [
1429,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_congr_ctx",
"code": "theorem imp_congr_ctx (h₁ : a ↔ c) (h₂ : c → (b ↔ d)) : (a → b) ↔ (c → d)",
"start": [
1431,
1
],
"end": [
1432,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_congr",
"code": "theorem imp_congr (h₁ : a ↔ c) (h₂ : b ↔ d) : (a → b) ↔ (c → d)",
"start": [
1434,
1
],
"end": [
1434,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_iff_not",
"code": "theorem imp_iff_not (hb : ¬b) : a → b ↔ ¬a",
"start": [
1436,
1
],
"end": [
1436,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.sound",
"code": "axiom sound : ∀ {α : Sort u} {r : α → α → Prop} {a b : α}, r a b → Quot.mk r a = Quot.mk r b",
"start": [
1441,
1
],
"end": [
1471,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.liftBeta",
"code": "protected theorem liftBeta {α : Sort u} {r : α → α → Prop} {β : Sort v}\n (f : α → β)\n (c : (a b : α) → r a b → f a = f b)\n (a : α)\n : lift f c (Quot.mk r a) = f a",
"start": [
1473,
1
],
"end": [
1478,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.indBeta",
"code": "protected theorem indBeta {α : Sort u} {r : α → α → Prop} {motive : Quot r → Prop}\n (p : (a : α) → motive (Quot.mk r a))\n (a : α)\n : (ind p (Quot.mk r a) : motive (Quot.mk r a)) = p a",
"start": [
1480,
1
],
"end": [
1484,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.liftOn",
"code": "protected abbrev liftOn {α : Sort u} {β : Sort v} {r : α → α → Prop}\n (q : Quot r) (f : α → β) (c : (a b : α) → r a b → f a = f b) : β :=\n lift f c q",
"start": [
1486,
1
],
"end": [
1492,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.inductionOn",
"code": "@[elab_as_elim]\nprotected theorem inductionOn {α : Sort u} {r : α → α → Prop} {motive : Quot r → Prop}\n (q : Quot r)\n (h : (a : α) → motive (Quot.mk r a))\n : motive q",
"start": [
1494,
1
],
"end": [
1499,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.exists_rep",
"code": "theorem exists_rep {α : Sort u} {r : α → α → Prop} (q : Quot r) : Exists (fun a => (Quot.mk r a) = q)",
"start": [
1501,
1
],
"end": [
1502,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.indep",
"code": "@[reducible, macro_inline]\nprotected def indep (f : (a : α) → motive (Quot.mk r a)) (a : α) : PSigma motive :=\n ⟨Quot.mk r a, f a⟩",
"start": [
1509,
1
],
"end": [
1512,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.indepCoherent",
"code": "protected theorem indepCoherent\n (f : (a : α) → motive (Quot.mk r a))\n (h : (a b : α) → (p : r a b) → Eq.ndrec (f a) (sound p) = f b)\n : (a b : α) → r a b → Quot.indep f a = Quot.indep f b",
"start": [
1514,
1
],
"end": [
1518,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.liftIndepPr1",
"code": "protected theorem liftIndepPr1\n (f : (a : α) → motive (Quot.mk r a))\n (h : ∀ (a b : α) (p : r a b), Eq.ndrec (f a) (sound p) = f b)\n (q : Quot r)\n : (lift (Quot.indep f) (Quot.indepCoherent f h) q).1 = q",
"start": [
1520,
1
],
"end": [
1526,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.rec",
"code": "protected abbrev rec\n (f : (a : α) → motive (Quot.mk r a))\n (h : (a b : α) → (p : r a b) → Eq.ndrec (f a) (sound p) = f b)\n (q : Quot r) : motive q :=\n Eq.ndrecOn (Quot.liftIndepPr1 f h q) ((lift (Quot.indep f) (Quot.indepCoherent f h) q).2)",
"start": [
1528,
1
],
"end": [
1540,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.recOn",
"code": "@[inherit_doc Quot.rec] protected abbrev recOn\n (q : Quot r)\n (f : (a : α) → motive (Quot.mk r a))\n (h : (a b : α) → (p : r a b) → Eq.ndrec (f a) (sound p) = f b)\n : motive q :=\n q.rec f h",
"start": [
1542,
1
],
"end": [
1547,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.recOnSubsingleton",
"code": "protected abbrev recOnSubsingleton\n [h : (a : α) → Subsingleton (motive (Quot.mk r a))]\n (q : Quot r)\n (f : (a : α) → motive (Quot.mk r a))\n : motive q := by\n induction q using Quot.rec\n apply f\n apply Subsingleton.elim",
"start": [
1549,
1
],
"end": [
1560,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Quot.hrecOn",
"code": "protected abbrev hrecOn\n (q : Quot r)\n (f : (a : α) → motive (Quot.mk r a))\n (c : (a b : α) → (p : r a b) → HEq (f a) (f b))\n : motive q :=\n Quot.recOn q f fun a b p => eq_of_heq <|\n have p₁ : HEq (Eq.ndrec (f a) (sound p)) (f a) := eqRec_heq (sound p) (f a)\n HEq.trans p₁ (c a b p)",
"start": [
1562,
1
],
"end": [
1574,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient",
"code": "def Quotient {α : Sort u} (s : Setoid α) :=\n @Quot α Setoid.r",
"start": [
1580,
1
],
"end": [
1586,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.mk",
"code": "@[inline]\nprotected def mk {α : Sort u} (s : Setoid α) (a : α) : Quotient s :=\n Quot.mk Setoid.r a",
"start": [
1590,
1
],
"end": [
1593,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.mk'",
"code": "protected def mk' {α : Sort u} [s : Setoid α] (a : α) : Quotient s :=\n Quotient.mk s a",
"start": [
1595,
1
],
"end": [
1600,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.sound",
"code": "theorem sound {α : Sort u} {s : Setoid α} {a b : α} : a ≈ b → Quotient.mk s a = Quotient.mk s b",
"start": [
1602,
1
],
"end": [
1607,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.lift",
"code": "protected abbrev lift {α : Sort u} {β : Sort v} {s : Setoid α} (f : α → β) : ((a b : α) → a ≈ b → f a = f b) → Quotient s → β :=\n Quot.lift f",
"start": [
1609,
1
],
"end": [
1614,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.ind",
"code": "protected theorem ind {α : Sort u} {s : Setoid α} {motive : Quotient s → Prop} : ((a : α) → motive (Quotient.mk s a)) → (q : Quotient s) → motive q",
"start": [
1616,
1
],
"end": [
1618,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.liftOn",
"code": "protected abbrev liftOn {α : Sort u} {β : Sort v} {s : Setoid α} (q : Quotient s) (f : α → β) (c : (a b : α) → a ≈ b → f a = f b) : β :=\n Quot.liftOn q f c",
"start": [
1620,
1
],
"end": [
1625,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.inductionOn",
"code": "@[elab_as_elim]\nprotected theorem inductionOn {α : Sort u} {s : Setoid α} {motive : Quotient s → Prop}\n (q : Quotient s)\n (h : (a : α) → motive (Quotient.mk s a))\n : motive q",
"start": [
1627,
1
],
"end": [
1633,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.exists_rep",
"code": "theorem exists_rep {α : Sort u} {s : Setoid α} (q : Quotient s) : Exists (fun (a : α) => Quotient.mk s a = q)",
"start": [
1635,
1
],
"end": [
1636,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.rec",
"code": "@[inline, elab_as_elim]\nprotected def rec\n (f : (a : α) → motive (Quotient.mk s a))\n (h : (a b : α) → (p : a ≈ b) → Eq.ndrec (f a) (Quotient.sound p) = f b)\n (q : Quotient s)\n : motive q :=\n Quot.rec f h q",
"start": [
1643,
1
],
"end": [
1650,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.recOn",
"code": "@[elab_as_elim]\nprotected abbrev recOn\n (q : Quotient s)\n (f : (a : α) → motive (Quotient.mk s a))\n (h : (a b : α) → (p : a ≈ b) → Eq.ndrec (f a) (Quotient.sound p) = f b)\n : motive q :=\n Quot.recOn q f h",
"start": [
1652,
1
],
"end": [
1659,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.recOnSubsingleton",
"code": "@[elab_as_elim]\nprotected abbrev recOnSubsingleton\n [h : (a : α) → Subsingleton (motive (Quotient.mk s a))]\n (q : Quotient s)\n (f : (a : α) → motive (Quotient.mk s a))\n : motive q :=\n Quot.recOnSubsingleton (h := h) q f",
"start": [
1661,
1
],
"end": [
1668,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.hrecOn",
"code": "@[elab_as_elim]\nprotected abbrev hrecOn\n (q : Quotient s)\n (f : (a : α) → motive (Quotient.mk s a))\n (c : (a b : α) → (p : a ≈ b) → HEq (f a) (f b))\n : motive q :=\n Quot.hrecOn q f c",
"start": [
1670,
1
],
"end": [
1677,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.lift₂",
"code": "protected abbrev lift₂\n (f : α → β → φ)\n (c : (a₁ : α) → (b₁ : β) → (a₂ : α) → (b₂ : β) → a₁ ≈ a₂ → b₁ ≈ b₂ → f a₁ b₁ = f a₂ b₂)\n (q₁ : Quotient s₁) (q₂ : Quotient s₂)\n : φ := by\n apply Quotient.lift (fun (a₁ : α) => Quotient.lift (f a₁) (fun (a b : β) => c a₁ a a₁ b (Setoid.refl a₁)) q₂) _ q₁\n intros\n induction q₂ using Quotient.ind\n apply c; assumption; apply Setoid.refl",
"start": [
1685,
1
],
"end": [
1694,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.liftOn₂",
"code": "protected abbrev liftOn₂\n (q₁ : Quotient s₁)\n (q₂ : Quotient s₂)\n (f : α → β → φ)\n (c : (a₁ : α) → (b₁ : β) → (a₂ : α) → (b₂ : β) → a₁ ≈ a₂ → b₁ ≈ b₂ → f a₁ b₁ = f a₂ b₂)\n : φ :=\n Quotient.lift₂ f c q₁ q₂",
"start": [
1696,
1
],
"end": [
1703,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.ind₂",
"code": "@[elab_as_elim]\nprotected theorem ind₂\n {motive : Quotient s₁ → Quotient s₂ → Prop}\n (h : (a : α) → (b : β) → motive (Quotient.mk s₁ a) (Quotient.mk s₂ b))\n (q₁ : Quotient s₁)\n (q₂ : Quotient s₂)\n : motive q₁ q₂",
"start": [
1705,
1
],
"end": [
1714,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.inductionOn₂",
"code": "@[elab_as_elim]\nprotected theorem inductionOn₂\n {motive : Quotient s₁ → Quotient s₂ → Prop}\n (q₁ : Quotient s₁)\n (q₂ : Quotient s₂)\n (h : (a : α) → (b : β) → motive (Quotient.mk s₁ a) (Quotient.mk s₂ b))\n : motive q₁ q₂",
"start": [
1716,
1
],
"end": [
1725,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.inductionOn₃",
"code": "@[elab_as_elim]\nprotected theorem inductionOn₃\n {s₃ : Setoid φ}\n {motive : Quotient s₁ → Quotient s₂ → Quotient s₃ → Prop}\n (q₁ : Quotient s₁)\n (q₂ : Quotient s₂)\n (q₃ : Quotient s₃)\n (h : (a : α) → (b : β) → (c : φ) → motive (Quotient.mk s₁ a) (Quotient.mk s₂ b) (Quotient.mk s₃ c))\n : motive q₁ q₂ q₃",
"start": [
1727,
1
],
"end": [
1739,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.rel",
"code": "private def rel {s : Setoid α} (q₁ q₂ : Quotient s) : Prop :=\n Quotient.liftOn₂ q₁ q₂\n (fun a₁ a₂ => a₁ ≈ a₂)\n (fun _ _ _ _ a₁b₁ a₂b₂ =>\n propext (Iff.intro\n (fun a₁a₂ => Setoid.trans (Setoid.symm a₁b₁) (Setoid.trans a₁a₂ a₂b₂))\n (fun b₁b₂ => Setoid.trans a₁b₁ (Setoid.trans b₁b₂ (Setoid.symm a₂b₂)))))",
"start": [
1747,
1
],
"end": [
1753,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.rel.refl",
"code": "private theorem rel.refl {s : Setoid α} (q : Quotient s) : rel q q",
"start": [
1755,
1
],
"end": [
1756,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.rel_of_eq",
"code": "private theorem rel_of_eq {s : Setoid α} {q₁ q₂ : Quotient s} : q₁ = q₂ → rel q₁ q₂",
"start": [
1758,
1
],
"end": [
1759,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.exact",
"code": "theorem exact {s : Setoid α} {a b : α} : Quotient.mk s a = Quotient.mk s b → a ≈ b",
"start": [
1761,
1
],
"end": [
1762,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Quotient.recOnSubsingleton₂",
"code": "@[elab_as_elim]\nprotected abbrev recOnSubsingleton₂\n {motive : Quotient s₁ → Quotient s₂ → Sort uC}\n [s : (a : α) → (b : β) → Subsingleton (motive (Quotient.mk s₁ a) (Quotient.mk s₂ b))]\n (q₁ : Quotient s₁)\n (q₂ : Quotient s₂)\n (g : (a : α) → (b : β) → motive (Quotient.mk s₁ a) (Quotient.mk s₂ b))\n : motive q₁ q₂ := by\n induction q₁ using Quot.recOnSubsingleton\n induction q₂ using Quot.recOnSubsingleton\n apply g\n intro a; apply s\n induction q₂ using Quot.recOnSubsingleton\n intro a; apply s\n infer_instance",
"start": [
1771,
1
],
"end": [
1786,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "funext",
"code": "theorem funext {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x}\n (h : ∀ x, f x = g x) : f = g",
"start": [
1805,
1
],
"end": [
1825,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Squash",
"code": "def Squash (α : Type u) := Quot (fun (_ _ : α) => True)",
"start": [
1832,
1
],
"end": [
1846,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Squash.mk",
"code": "def Squash.mk {α : Type u} (x : α) : Squash α := Quot.mk _ x",
"start": [
1848,
1
],
"end": [
1849,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Squash.ind",
"code": "theorem Squash.ind {α : Type u} {motive : Squash α → Prop} (h : ∀ (a : α), motive (Squash.mk a)) : ∀ (q : Squash α), motive q",
"start": [
1851,
1
],
"end": [
1852,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Squash.lift",
"code": "@[inline] def Squash.lift {α β} [Subsingleton β] (s : Squash α) (f : α → β) : β :=\n Quot.lift f (fun _ _ _ => Subsingleton.elim _ _) s",
"start": [
1854,
1
],
"end": [
1856,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Antisymm",
"code": "class Antisymm {α : Sort u} (r : α → α → Prop) where\n \n antisymm {a b : α} : r a b → r b a → a = b",
"start": [
1867,
1
],
"end": [
1872,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.trustCompiler",
"code": "axiom trustCompiler : True",
"start": [
1877,
1
],
"end": [
1880,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.reduceBool",
"code": "opaque reduceBool (b : Bool) : Bool :=\n have := trustCompiler\n b",
"start": [
1882,
1
],
"end": [
1904,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.reduceNat",
"code": "opaque reduceNat (n : Nat) : Nat :=\n have := trustCompiler\n n",
"start": [
1906,
1
],
"end": [
1916,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.ofReduceBool",
"code": "axiom ofReduceBool (a b : Bool) (h : reduceBool a = b) : a = b",
"start": [
1919,
1
],
"end": [
1932,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.ofReduceNat",
"code": "axiom ofReduceNat (a b : Nat) (h : reduceNat a = b) : a = b",
"start": [
1934,
1
],
"end": [
1943,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "ge_iff_le",
"code": "@[simp] theorem ge_iff_le [LE α] {x y : α} : x ≥ y ↔ y ≤ x",
"start": [
1947,
1
],
"end": [
1947,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "gt_iff_lt",
"code": "@[simp] theorem gt_iff_lt [LT α] {x y : α} : x > y ↔ y < x",
"start": [
1949,
1
],
"end": [
1949,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "le_of_eq_of_le",
"code": "theorem le_of_eq_of_le {a b c : α} [LE α] (h₁ : a = b) (h₂ : b ≤ c) : a ≤ c",
"start": [
1951,
1
],
"end": [
1951,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "le_of_le_of_eq",
"code": "theorem le_of_le_of_eq {a b c : α} [LE α] (h₁ : a ≤ b) (h₂ : b = c) : a ≤ c",
"start": [
1953,
1
],
"end": [
1953,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_of_eq_of_lt",
"code": "theorem lt_of_eq_of_lt {a b c : α} [LT α] (h₁ : a = b) (h₂ : b < c) : a < c",
"start": [
1955,
1
],
"end": [
1955,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_of_lt_of_eq",
"code": "theorem lt_of_lt_of_eq {a b c : α} [LT α] (h₁ : a < b) (h₂ : b = c) : a < c",
"start": [
1957,
1
],
"end": [
1957,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Associative",
"code": "class Associative (op : α → α → α) : Prop where\n \n assoc : (a b c : α) → op (op a b) c = op a (op b c)",
"start": [
1962,
1
],
"end": [
1968,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Commutative",
"code": "class Commutative (op : α → α → α) : Prop where\n \n comm : (a b : α) → op a b = op b a",
"start": [
1970,
1
],
"end": [
1976,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.IdempotentOp",
"code": "class IdempotentOp (op : α → α → α) : Prop where\n \n idempotent : (x : α) → op x x = x",
"start": [
1978,
1
],
"end": [
1984,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.LeftIdentity",
"code": "class LeftIdentity (op : α → β → β) (o : outParam α) : Prop",
"start": [
1986,
1
],
"end": [
1992,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.LawfulLeftIdentity",
"code": "class LawfulLeftIdentity (op : α → β → β) (o : outParam α) extends LeftIdentity op o : Prop where\n \n left_id : ∀ a, op o a = a",
"start": [
1994,
1
],
"end": [
2000,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.RightIdentity",
"code": "class RightIdentity (op : α → β → α) (o : outParam β) : Prop",
"start": [
2002,
1
],
"end": [
2008,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.LawfulRightIdentity",
"code": "class LawfulRightIdentity (op : α → β → α) (o : outParam β) extends RightIdentity op o : Prop where\n \n right_id : ∀ a, op a o = a",
"start": [
2010,
1
],
"end": [
2016,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Identity",
"code": "class Identity (op : α → α → α) (o : outParam α) extends LeftIdentity op o, RightIdentity op o : Prop",
"start": [
2018,
1
],
"end": [
2024,
102
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.LawfulIdentity",
"code": "class LawfulIdentity (op : α → α → α) (o : outParam α) extends Identity op o, LawfulLeftIdentity op o, LawfulRightIdentity op o : Prop",
"start": [
2026,
1
],
"end": [
2030,
135
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.LawfulCommIdentity",
"code": "class LawfulCommIdentity (op : α → α → α) (o : outParam α) [hc : Commutative op] extends LawfulIdentity op o : Prop where\n left_id a := Eq.trans (hc.comm o a) (right_id a)\n right_id a := Eq.trans (hc.comm a o) (left_id a)",
"start": [
2032,
1
],
"end": [
2043,
51
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/SimpLemmas.lean | [
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "of_eq_true",
"code": "theorem of_eq_true (h : p = True) : p",
"start": [
12,
1
],
"end": [
12,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "of_eq_false",
"code": "theorem of_eq_false (h : p = False) : ¬ p",
"start": [
13,
1
],
"end": [
13,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_true",
"code": "theorem eq_true (h : p) : p = True",
"start": [
15,
1
],
"end": [
16,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_false",
"code": "theorem eq_false (h : ¬ p) : p = False",
"start": [
21,
1
],
"end": [
22,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_false'",
"code": "theorem eq_false' (h : p → False) : p = False",
"start": [
24,
1
],
"end": [
24,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_true_of_decide",
"code": "theorem eq_true_of_decide {p : Prop} [Decidable p] (h : decide p = true) : p = True",
"start": [
26,
1
],
"end": [
27,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_false_of_decide",
"code": "theorem eq_false_of_decide {p : Prop} {_ : Decidable p} (h : decide p = false) : p = False",
"start": [
29,
1
],
"end": [
30,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_self",
"code": "@[simp] theorem eq_self (a : α) : (a = a) = True",
"start": [
32,
1
],
"end": [
32,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "implies_congr",
"code": "theorem implies_congr {p₁ p₂ : Sort u} {q₁ q₂ : Sort v} (h₁ : p₁ = p₂) (h₂ : q₁ = q₂) : (p₁ → q₁) = (p₂ → q₂)",
"start": [
34,
1
],
"end": [
35,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_congr",
"code": "theorem iff_congr {p₁ p₂ q₁ q₂ : Prop} (h₁ : p₁ ↔ p₂) (h₂ : q₁ ↔ q₂) : (p₁ ↔ q₁) ↔ (p₂ ↔ q₂)",
"start": [
37,
1
],
"end": [
38,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "implies_dep_congr_ctx",
"code": "theorem implies_dep_congr_ctx {p₁ p₂ q₁ : Prop} (h₁ : p₁ = p₂) {q₂ : p₂ → Prop} (h₂ : (h : p₂) → q₁ = q₂ h) : (p₁ → q₁) = ((h : p₂) → q₂ h)",
"start": [
40,
1
],
"end": [
43,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "implies_congr_ctx",
"code": "theorem implies_congr_ctx {p₁ p₂ q₁ q₂ : Prop} (h₁ : p₁ = p₂) (h₂ : p₂ → q₁ = q₂) : (p₁ → q₁) = (p₂ → q₂)",
"start": [
45,
1
],
"end": [
46,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_congr",
"code": "theorem forall_congr {α : Sort u} {p q : α → Prop} (h : ∀ a, p a = q a) : (∀ a, p a) = (∀ a, q a)",
"start": [
48,
1
],
"end": [
49,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_prop_domain_congr",
"code": "theorem forall_prop_domain_congr {p₁ p₂ : Prop} {q₁ : p₁ → Prop} {q₂ : p₂ → Prop}\n (h₁ : p₁ = p₂)\n (h₂ : ∀ a : p₂, q₁ (h₁.substr a) = q₂ a)\n : (∀ a : p₁, q₁ a) = (∀ a : p₂, q₂ a)",
"start": [
51,
1
],
"end": [
55,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "let_congr",
"code": "theorem let_congr {α : Sort u} {β : Sort v} {a a' : α} {b b' : α → β}\n (h₁ : a = a') (h₂ : ∀ x, b x = b' x) : (let x := a; b x) = (let x := a'; b' x)",
"start": [
57,
1
],
"end": [
59,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "let_val_congr",
"code": "theorem let_val_congr {α : Sort u} {β : Sort v} {a a' : α}\n (b : α → β) (h : a = a') : (let x := a; b x) = (let x := a'; b x)",
"start": [
61,
1
],
"end": [
62,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "let_body_congr",
"code": "theorem let_body_congr {α : Sort u} {β : α → Sort v} {b b' : (a : α) → β a}\n (a : α) (h : ∀ x, b x = b' x) : (let x := a; b x) = (let x := a; b' x)",
"start": [
64,
1
],
"end": [
66,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_congr",
"code": "@[congr]\ntheorem ite_congr {x y u v : α} {s : Decidable b} [Decidable c]\n (h₁ : b = c) (h₂ : c → x = u) (h₃ : ¬ c → y = v) : ite b x y = ite c u v",
"start": [
68,
1
],
"end": [
73,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.mpr_prop",
"code": "theorem Eq.mpr_prop {p q : Prop} (h₁ : p = q) (h₂ : q) : p",
"start": [
75,
1
],
"end": [
75,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Eq.mpr_not",
"code": "theorem Eq.mpr_not {p q : Prop} (h₁ : p = q) (h₂ : ¬q) : ¬p",
"start": [
76,
1
],
"end": [
76,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_congr",
"code": "@[congr]\ntheorem dite_congr {_ : Decidable b} [Decidable c]\n {x : b → α} {u : c → α} {y : ¬b → α} {v : ¬c → α}\n (h₁ : b = c)\n (h₂ : (h : c) → x (h₁.mpr_prop h) = u h)\n (h₃ : (h : ¬c) → y (h₁.mpr_not h) = v h) :\n dite b x y = dite c u v",
"start": [
78,
1
],
"end": [
87,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_eq",
"code": "@[simp] theorem ne_eq (a b : α) : (a ≠ b) = ¬(a = b)",
"start": [
89,
1
],
"end": [
89,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_true",
"code": "@[simp] theorem ite_true (a b : α) : (if True then a else b) = a",
"start": [
91,
1
],
"end": [
91,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_false",
"code": "@[simp] theorem ite_false (a b : α) : (if False then a else b) = b",
"start": [
92,
1
],
"end": [
92,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_true",
"code": "@[simp] theorem dite_true {α : Sort u} {t : True → α} {e : ¬ True → α} : (dite True t e) = t True.intro",
"start": [
93,
1
],
"end": [
93,
111
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_false",
"code": "@[simp] theorem dite_false {α : Sort u} {t : False → α} {e : ¬ False → α} : (dite False t e) = e not_false",
"start": [
94,
1
],
"end": [
94,
114
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_cond_eq_true",
"code": "theorem ite_cond_eq_true {α : Sort u} {c : Prop} {_ : Decidable c} (a b : α) (h : c = True) : (if c then a else b) = a",
"start": [
97,
1
],
"end": [
97,
134
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_cond_eq_false",
"code": "theorem ite_cond_eq_false {α : Sort u} {c : Prop} {_ : Decidable c} (a b : α) (h : c = False) : (if c then a else b) = b",
"start": [
98,
1
],
"end": [
98,
136
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_cond_eq_true",
"code": "theorem dite_cond_eq_true {α : Sort u} {c : Prop} {_ : Decidable c} {t : c → α} {e : ¬ c → α} (h : c = True) : (dite c t e) = t (of_eq_true h)",
"start": [
99,
1
],
"end": [
99,
158
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_cond_eq_false",
"code": "theorem dite_cond_eq_false {α : Sort u} {c : Prop} {_ : Decidable c} {t : c → α} {e : ¬ c → α} (h : c = False) : (dite c t e) = e (of_eq_false h)",
"start": [
100,
1
],
"end": [
100,
161
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_self",
"code": "@[simp] theorem ite_self {α : Sort u} {c : Prop} {d : Decidable c} (a : α) : ite c a a = a",
"start": [
102,
1
],
"end": [
102,
113
],
"kind": "commanddeclaration"
},
{
"full_name": "and_true",
"code": "@[simp] theorem and_true (p : Prop) : (p ∧ True) = p",
"start": [
104,
1
],
"end": [
104,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "true_and",
"code": "@[simp] theorem true_and (p : Prop) : (True ∧ p) = p",
"start": [
105,
1
],
"end": [
105,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "and_false",
"code": "@[simp] theorem and_false (p : Prop) : (p ∧ False) = False",
"start": [
109,
1
],
"end": [
109,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "false_and",
"code": "@[simp] theorem false_and (p : Prop) : (False ∧ p) = False",
"start": [
110,
1
],
"end": [
110,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "and_self",
"code": "@[simp] theorem and_self (p : Prop) : (p ∧ p) = p",
"start": [
111,
1
],
"end": [
111,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "and_not_self",
"code": "@[simp] theorem and_not_self : ¬(a ∧ ¬a)",
"start": [
113,
1
],
"end": [
113,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and_self",
"code": "@[simp] theorem not_and_self : ¬(¬a ∧ a)",
"start": [
114,
1
],
"end": [
114,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "and_imp",
"code": "@[simp] theorem and_imp : (a ∧ b → c) ↔ (a → b → c)",
"start": [
115,
1
],
"end": [
115,
110
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and",
"code": "@[simp] theorem not_and : ¬(a ∧ b) ↔ (a → ¬b)",
"start": [
116,
1
],
"end": [
116,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "or_self",
"code": "@[simp] theorem or_self (p : Prop) : (p ∨ p) = p",
"start": [
117,
1
],
"end": [
117,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "or_true",
"code": "@[simp] theorem or_true (p : Prop) : (p ∨ True) = True",
"start": [
119,
1
],
"end": [
119,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "true_or",
"code": "@[simp] theorem true_or (p : Prop) : (True ∨ p) = True",
"start": [
120,
1
],
"end": [
120,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "or_false",
"code": "@[simp] theorem or_false (p : Prop) : (p ∨ False) = p",
"start": [
121,
1
],
"end": [
121,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "false_or",
"code": "@[simp] theorem false_or (p : Prop) : (False ∨ p) = p",
"start": [
122,
1
],
"end": [
122,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_self",
"code": "@[simp] theorem iff_self (p : Prop) : (p ↔ p) = True",
"start": [
126,
1
],
"end": [
126,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_true",
"code": "@[simp] theorem iff_true (p : Prop) : (p ↔ True) = p",
"start": [
127,
1
],
"end": [
127,
121
],
"kind": "commanddeclaration"
},
{
"full_name": "true_iff",
"code": "@[simp] theorem true_iff (p : Prop) : (True ↔ p) = p",
"start": [
128,
1
],
"end": [
128,
121
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_false",
"code": "@[simp] theorem iff_false (p : Prop) : (p ↔ False) = ¬p",
"start": [
129,
1
],
"end": [
129,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "false_iff",
"code": "@[simp] theorem false_iff (p : Prop) : (False ↔ p) = ¬p",
"start": [
130,
1
],
"end": [
130,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "false_implies",
"code": "@[simp] theorem false_implies (p : Prop) : (False → p) = True",
"start": [
131,
1
],
"end": [
131,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "implies_true",
"code": "@[simp] theorem implies_true (α : Sort u) : (α → True) = True",
"start": [
132,
1
],
"end": [
132,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "true_implies",
"code": "@[simp] theorem true_implies (p : Prop) : (True → p) = p",
"start": [
133,
1
],
"end": [
133,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "not_false_eq_true",
"code": "@[simp] theorem not_false_eq_true : (¬ False) = True",
"start": [
134,
1
],
"end": [
134,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "not_true_eq_false",
"code": "@[simp] theorem not_true_eq_false : (¬ True) = False",
"start": [
135,
1
],
"end": [
135,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "not_iff_self",
"code": "@[simp] theorem not_iff_self : ¬(¬a ↔ a)",
"start": [
137,
1
],
"end": [
137,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_right",
"code": "theorem and_congr_right (h : a → (b ↔ c)) : a ∧ b ↔ a ∧ c",
"start": [
142,
1
],
"end": [
144,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_left",
"code": "theorem and_congr_left (h : c → (a ↔ b)) : a ∧ c ↔ b ∧ c",
"start": [
145,
1
],
"end": [
146,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "and_assoc",
"code": "theorem and_assoc : (a ∧ b) ∧ c ↔ a ∧ (b ∧ c)",
"start": [
148,
1
],
"end": [
150,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "and_self_left",
"code": "@[simp] theorem and_self_left : a ∧ (a ∧ b) ↔ a ∧ b",
"start": [
153,
1
],
"end": [
153,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "and_self_right",
"code": "@[simp] theorem and_self_right : (a ∧ b) ∧ b ↔ a ∧ b",
"start": [
154,
1
],
"end": [
154,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_right_iff",
"code": "@[simp] theorem and_congr_right_iff : (a ∧ b ↔ a ∧ c) ↔ (a → (b ↔ c))",
"start": [
156,
1
],
"end": [
157,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_left_iff",
"code": "@[simp] theorem and_congr_left_iff : (a ∧ c ↔ b ∧ c) ↔ c → (a ↔ b)",
"start": [
158,
1
],
"end": [
159,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_left_of_imp",
"code": "theorem and_iff_left_of_imp (h : a → b) : (a ∧ b) ↔ a",
"start": [
161,
1
],
"end": [
161,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_right_of_imp",
"code": "theorem and_iff_right_of_imp (h : b → a) : (a ∧ b) ↔ b",
"start": [
162,
1
],
"end": [
162,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_left_iff_imp",
"code": "@[simp] theorem and_iff_left_iff_imp : ((a ∧ b) ↔ a) ↔ (a → b)",
"start": [
164,
1
],
"end": [
164,
117
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_right_iff_imp",
"code": "@[simp] theorem and_iff_right_iff_imp : ((a ∧ b) ↔ b) ↔ (b → a)",
"start": [
165,
1
],
"end": [
165,
117
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_self_and",
"code": "@[simp] theorem iff_self_and : (p ↔ p ∧ q) ↔ (p → q)",
"start": [
167,
1
],
"end": [
167,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_and_self",
"code": "@[simp] theorem iff_and_self : (p ↔ q ∧ p) ↔ (p → q)",
"start": [
168,
1
],
"end": [
168,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.imp",
"code": "theorem Or.imp (f : a → c) (g : b → d) (h : a ∨ b) : c ∨ d",
"start": [
172,
1
],
"end": [
172,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.imp_left",
"code": "theorem Or.imp_left (f : a → b) : a ∨ c → b ∨ c",
"start": [
173,
1
],
"end": [
173,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.imp_right",
"code": "theorem Or.imp_right (f : b → c) : a ∨ b → a ∨ c",
"start": [
174,
1
],
"end": [
174,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "or_assoc",
"code": "theorem or_assoc : (a ∨ b) ∨ c ↔ a ∨ (b ∨ c)",
"start": [
176,
1
],
"end": [
178,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "or_self_left",
"code": "@[simp] theorem or_self_left : a ∨ (a ∨ b) ↔ a ∨ b",
"start": [
181,
1
],
"end": [
181,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "or_self_right",
"code": "@[simp] theorem or_self_right : (a ∨ b) ∨ b ↔ a ∨ b",
"start": [
182,
1
],
"end": [
182,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_right_of_imp",
"code": "theorem or_iff_right_of_imp (ha : a → b) : (a ∨ b) ↔ b",
"start": [
184,
1
],
"end": [
184,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_left_of_imp",
"code": "theorem or_iff_left_of_imp (hb : b → a) : (a ∨ b) ↔ a",
"start": [
185,
1
],
"end": [
185,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_left_iff_imp",
"code": "@[simp] theorem or_iff_left_iff_imp : (a ∨ b ↔ a) ↔ (b → a)",
"start": [
187,
1
],
"end": [
187,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_right_iff_imp",
"code": "@[simp] theorem or_iff_right_iff_imp : (a ∨ b ↔ b) ↔ (a → b)",
"start": [
188,
1
],
"end": [
188,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_self_or",
"code": "@[simp] theorem iff_self_or (a b : Prop) : (a ↔ a ∨ b) ↔ (b → a)",
"start": [
190,
1
],
"end": [
191,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "iff_or_self",
"code": "@[simp] theorem iff_or_self (a b : Prop) : (b ↔ a ∨ b) ↔ (a → b)",
"start": [
192,
1
],
"end": [
193,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_false",
"code": "@[simp] theorem Bool.or_false (b : Bool) : (b || false) = b",
"start": [
197,
1
],
"end": [
197,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_true",
"code": "@[simp] theorem Bool.or_true (b : Bool) : (b || true) = true",
"start": [
198,
1
],
"end": [
198,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_or",
"code": "@[simp] theorem Bool.false_or (b : Bool) : (false || b) = b",
"start": [
199,
1
],
"end": [
199,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_or",
"code": "@[simp] theorem Bool.true_or (b : Bool) : (true || b) = true",
"start": [
203,
1
],
"end": [
203,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_self",
"code": "@[simp] theorem Bool.or_self (b : Bool) : (b || b) = b",
"start": [
204,
1
],
"end": [
204,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_eq_true",
"code": "@[simp] theorem Bool.or_eq_true (a b : Bool) : ((a || b) = true) = (a = true ∨ b = true)",
"start": [
206,
1
],
"end": [
207,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_false",
"code": "@[simp] theorem Bool.and_false (b : Bool) : (b && false) = false",
"start": [
209,
1
],
"end": [
209,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_true",
"code": "@[simp] theorem Bool.and_true (b : Bool) : (b && true) = b",
"start": [
210,
1
],
"end": [
210,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_and",
"code": "@[simp] theorem Bool.false_and (b : Bool) : (false && b) = false",
"start": [
211,
1
],
"end": [
211,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_and",
"code": "@[simp] theorem Bool.true_and (b : Bool) : (true && b) = b",
"start": [
212,
1
],
"end": [
212,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_self",
"code": "@[simp] theorem Bool.and_self (b : Bool) : (b && b) = b",
"start": [
216,
1
],
"end": [
216,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_eq_true",
"code": "@[simp] theorem Bool.and_eq_true (a b : Bool) : ((a && b) = true) = (a = true ∧ b = true)",
"start": [
218,
1
],
"end": [
219,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_assoc",
"code": "theorem Bool.and_assoc (a b c : Bool) : (a && b && c) = (a && (b && c))",
"start": [
221,
1
],
"end": [
222,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_assoc",
"code": "theorem Bool.or_assoc (a b c : Bool) : (a || b || c) = (a || (b || c))",
"start": [
224,
1
],
"end": [
225,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_not",
"code": "@[simp] theorem Bool.not_not (b : Bool) : (!!b) = b",
"start": [
228,
1
],
"end": [
228,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_true",
"code": "@[simp] theorem Bool.not_true : (!true) = false",
"start": [
229,
1
],
"end": [
229,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_false",
"code": "@[simp] theorem Bool.not_false : (!false) = true",
"start": [
230,
1
],
"end": [
230,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_beq_true",
"code": "@[simp] theorem Bool.not_beq_true (b : Bool) : (!(b == true)) = (b == false)",
"start": [
231,
1
],
"end": [
231,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_beq_false",
"code": "@[simp] theorem Bool.not_beq_false (b : Bool) : (!(b == false)) = (b == true)",
"start": [
232,
1
],
"end": [
232,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_true'",
"code": "@[simp] theorem Bool.not_eq_true' (b : Bool) : ((!b) = true) = (b = false)",
"start": [
233,
1
],
"end": [
233,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_false'",
"code": "@[simp] theorem Bool.not_eq_false' (b : Bool) : ((!b) = false) = (b = true)",
"start": [
234,
1
],
"end": [
234,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_to_eq",
"code": "@[simp] theorem Bool.beq_to_eq (a b : Bool) :\n (a == b) = (a = b)",
"start": [
236,
1
],
"end": [
237,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_beq_to_not_eq",
"code": "@[simp] theorem Bool.not_beq_to_not_eq (a b : Bool) :\n (!(a == b)) = ¬(a = b)",
"start": [
238,
1
],
"end": [
239,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_true",
"code": "@[simp] theorem Bool.not_eq_true (b : Bool) : (¬(b = true)) = (b = false)",
"start": [
241,
1
],
"end": [
241,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_false",
"code": "@[simp] theorem Bool.not_eq_false (b : Bool) : (¬(b = false)) = (b = true)",
"start": [
242,
1
],
"end": [
242,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_true_eq",
"code": "@[simp] theorem decide_eq_true_eq [Decidable p] : (decide p = true) = p",
"start": [
244,
1
],
"end": [
245,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_not",
"code": "@[simp] theorem decide_not [g : Decidable p] [h : Decidable (Not p)] : decide (Not p) = !(decide p)",
"start": [
246,
1
],
"end": [
247,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "not_decide_eq_true",
"code": "@[simp] theorem not_decide_eq_true [h : Decidable p] : ((!decide p) = true) = ¬ p",
"start": [
248,
1
],
"end": [
249,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "heq_eq_eq",
"code": "@[simp] theorem heq_eq_eq (a b : α) : HEq a b = (a = b)",
"start": [
251,
1
],
"end": [
251,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "cond_true",
"code": "@[simp] theorem cond_true (a b : α) : cond true a b = a",
"start": [
253,
1
],
"end": [
253,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "cond_false",
"code": "@[simp] theorem cond_false (a b : α) : cond false a b = b",
"start": [
254,
1
],
"end": [
254,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "beq_self_eq_true",
"code": "@[simp] theorem beq_self_eq_true [BEq α] [LawfulBEq α] (a : α) : (a == a) = true",
"start": [
256,
1
],
"end": [
256,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "beq_self_eq_true'",
"code": "@[simp] theorem beq_self_eq_true' [DecidableEq α] (a : α) : (a == a) = true",
"start": [
257,
1
],
"end": [
257,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "bne_self_eq_false",
"code": "@[simp] theorem bne_self_eq_false [BEq α] [LawfulBEq α] (a : α) : (a != a) = false",
"start": [
259,
1
],
"end": [
259,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "bne_self_eq_false'",
"code": "@[simp] theorem bne_self_eq_false' [DecidableEq α] (a : α) : (a != a) = false",
"start": [
260,
1
],
"end": [
260,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_False",
"code": "@[simp] theorem decide_False : decide False = false",
"start": [
262,
1
],
"end": [
262,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_True",
"code": "@[simp] theorem decide_True : decide True = true",
"start": [
263,
1
],
"end": [
263,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "bne_iff_ne",
"code": "@[simp] theorem bne_iff_ne [BEq α] [LawfulBEq α] (a b : α) : a != b ↔ a ≠ b",
"start": [
265,
1
],
"end": [
266,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "beq_eq_false_iff_ne",
"code": "@[simp] theorem beq_eq_false_iff_ne [BEq α] [LawfulBEq α]\n (a b : α) : (a == b) = false ↔ a ≠ b",
"start": [
276,
1
],
"end": [
279,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "bne_eq_false_iff_eq",
"code": "@[simp] theorem bne_eq_false_iff_eq [BEq α] [LawfulBEq α] (a b : α) :\n (a != b) = false ↔ a = b",
"start": [
281,
1
],
"end": [
284,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_zero_eq",
"code": "@[simp] theorem Nat.le_zero_eq (a : Nat) : (a ≤ 0) = (a = 0)",
"start": [
288,
1
],
"end": [
289,
84
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean | [
".lake/packages/lean4/src/lean/Init/SimpLemmas.lean"
] | [
{
"full_name": "Nat.recCompiled",
"code": "private def recCompiled {motive : Nat → Sort u} (zero : motive zero) (succ : (n : Nat) → motive n → motive (Nat.succ n)) : (t : Nat) → motive t\n | .zero => zero\n | .succ n => succ n (recCompiled zero succ n)",
"start": [
13,
1
],
"end": [
17,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.rec_eq_recCompiled",
"code": "@[csimp]\nprivate theorem rec_eq_recCompiled : @Nat.rec = @Nat.recCompiled",
"start": [
19,
1
],
"end": [
22,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.recAux",
"code": "@[elab_as_elim, induction_eliminator]\nprotected abbrev recAux {motive : Nat → Sort u} (zero : motive 0) (succ : (n : Nat) → motive n → motive (n + 1)) (t : Nat) : motive t :=\n Nat.rec zero succ t",
"start": [
24,
1
],
"end": [
28,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.casesAuxOn",
"code": "@[elab_as_elim, cases_eliminator]\nprotected abbrev casesAuxOn {motive : Nat → Sort u} (t : Nat) (zero : motive 0) (succ : (n : Nat) → motive (n + 1)) : motive t :=\n Nat.casesOn t zero succ",
"start": [
30,
1
],
"end": [
34,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.fold",
"code": "@[specialize] def fold {α : Type u} (f : Nat → α → α) : (n : Nat) → (init : α) → α\n | 0, a => a\n | succ n, a => f n (fold f n a)",
"start": [
36,
1
],
"end": [
42,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.foldTR",
"code": "@[inline] def foldTR {α : Type u} (f : Nat → α → α) (n : Nat) (init : α) : α :=\n let rec @[specialize] loop\n | 0, a => a\n | succ m, a => loop m (f (n - succ m) a)\n loop n init",
"start": [
44,
1
],
"end": [
49,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.foldRev",
"code": "@[specialize] def foldRev {α : Type u} (f : Nat → α → α) : (n : Nat) → (init : α) → α\n | 0, a => a\n | succ n, a => foldRev f n (f n a)",
"start": [
51,
1
],
"end": [
57,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.any",
"code": "@[specialize] def any (f : Nat → Bool) : Nat → Bool\n | 0 => false\n | succ n => any f n || f n",
"start": [
59,
1
],
"end": [
62,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.anyTR",
"code": "@[inline] def anyTR (f : Nat → Bool) (n : Nat) : Bool :=\n let rec @[specialize] loop : Nat → Bool\n | 0 => false\n | succ m => f (n - succ m) || loop m\n loop n",
"start": [
64,
1
],
"end": [
69,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.all",
"code": "@[specialize] def all (f : Nat → Bool) : Nat → Bool\n | 0 => true\n | succ n => all f n && f n",
"start": [
71,
1
],
"end": [
74,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.allTR",
"code": "@[inline] def allTR (f : Nat → Bool) (n : Nat) : Bool :=\n let rec @[specialize] loop : Nat → Bool\n | 0 => true\n | succ m => f (n - succ m) && loop m\n loop n",
"start": [
76,
1
],
"end": [
81,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.repeat",
"code": "@[specialize] def repeat {α : Type u} (f : α → α) : (n : Nat) → (a : α) → α\n | 0, a => a\n | succ n, a => f (repeat f n a)",
"start": [
83,
1
],
"end": [
89,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.repeatTR",
"code": "@[inline] def repeatTR {α : Type u} (f : α → α) (n : Nat) (a : α) : α :=\n let rec @[specialize] loop\n | 0, a => a\n | succ n, a => loop n (f a)\n loop n a",
"start": [
91,
1
],
"end": [
96,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.blt",
"code": "def blt (a b : Nat) : Bool :=\n ble a.succ b",
"start": [
98,
1
],
"end": [
100,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_eq",
"code": "@[simp] theorem zero_eq : Nat.zero = 0",
"start": [
106,
1
],
"end": [
106,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_eq",
"code": "@[simp] theorem add_eq : Nat.add x y = x + y",
"start": [
107,
1
],
"end": [
107,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_eq",
"code": "@[simp] theorem mul_eq : Nat.mul x y = x * y",
"start": [
108,
1
],
"end": [
108,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq",
"code": "@[simp] theorem sub_eq : Nat.sub x y = x - y",
"start": [
109,
1
],
"end": [
109,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_eq",
"code": "@[simp] theorem lt_eq : Nat.lt x y = (x < y)",
"start": [
110,
1
],
"end": [
110,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_eq",
"code": "@[simp] theorem le_eq : Nat.le x y = (x ≤ y)",
"start": [
111,
1
],
"end": [
111,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.beq_refl",
"code": "@[simp] theorem beq_refl (a : Nat) : Nat.beq a a = true",
"start": [
115,
1
],
"end": [
117,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.beq_eq",
"code": "@[simp] theorem beq_eq : (Nat.beq x y = true) = (x = y)",
"start": [
119,
1
],
"end": [
119,
134
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ble_eq",
"code": "@[simp] theorem ble_eq : (Nat.ble x y = true) = (x ≤ y)",
"start": [
120,
1
],
"end": [
120,
124
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.blt_eq",
"code": "@[simp] theorem blt_eq : (Nat.blt x y = true) = (x < y)",
"start": [
121,
1
],
"end": [
121,
124
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.beq_eq_true_eq",
"code": "@[simp] theorem beq_eq_true_eq (a b : Nat) : ((a == b) = true) = (a = b)",
"start": [
127,
1
],
"end": [
127,
150
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_beq_eq_true_eq",
"code": "@[simp] theorem not_beq_eq_true_eq (a b : Nat) : ((!(a == b)) = true) = ¬(a = b)",
"start": [
128,
1
],
"end": [
133,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_add",
"code": "@[simp] protected theorem zero_add : ∀ (n : Nat), 0 + n = n",
"start": [
137,
1
],
"end": [
139,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_add",
"code": "theorem succ_add : ∀ (n m : Nat), (succ n) + m = succ (n + m)",
"start": [
144,
1
],
"end": [
146,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_succ",
"code": "theorem add_succ (n m : Nat) : n + succ m = succ (n + m)",
"start": [
148,
1
],
"end": [
149,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one",
"code": "theorem add_one (n : Nat) : n + 1 = succ n",
"start": [
151,
1
],
"end": [
152,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_eq_add_one",
"code": "@[simp] theorem succ_eq_add_one (n : Nat) : succ n = n + 1",
"start": [
154,
1
],
"end": [
155,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_ne_zero",
"code": "@[simp] theorem add_one_ne_zero (n : Nat) : n + 1 ≠ 0",
"start": [
157,
1
],
"end": [
157,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_ne_add_one",
"code": "@[simp] theorem zero_ne_add_one (n : Nat) : 0 ≠ n + 1",
"start": [
158,
1
],
"end": [
158,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_comm",
"code": "protected theorem add_comm : ∀ (n m : Nat), n + m = m + n",
"start": [
160,
1
],
"end": [
165,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_assoc",
"code": "protected theorem add_assoc : ∀ (n m k : Nat), (n + m) + k = n + (m + k)",
"start": [
168,
1
],
"end": [
170,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_left_comm",
"code": "protected theorem add_left_comm (n m k : Nat) : n + (m + k) = m + (n + k)",
"start": [
173,
1
],
"end": [
174,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_right_comm",
"code": "protected theorem add_right_comm (n m k : Nat) : (n + m) + k = (n + k) + m",
"start": [
176,
1
],
"end": [
177,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_left_cancel",
"code": "protected theorem add_left_cancel {n m k : Nat} : n + m = n + k → m = k",
"start": [
179,
1
],
"end": [
182,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_right_cancel",
"code": "protected theorem add_right_cancel {n m k : Nat} (h : n + m = k + m) : n = k",
"start": [
184,
1
],
"end": [
186,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_add_eq_zero",
"code": "theorem eq_zero_of_add_eq_zero : ∀ {n m}, n + m = 0 → n = 0 ∧ m = 0",
"start": [
188,
1
],
"end": [
190,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_add_eq_zero_left",
"code": "protected theorem eq_zero_of_add_eq_zero_left (h : n + m = 0) : m = 0",
"start": [
192,
1
],
"end": [
193,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_zero",
"code": "@[simp] protected theorem mul_zero (n : Nat) : n * 0 = 0",
"start": [
197,
1
],
"end": [
198,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_succ",
"code": "theorem mul_succ (n m : Nat) : n * succ m = n * m + n",
"start": [
200,
1
],
"end": [
201,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_add_one",
"code": "theorem mul_add_one (n m : Nat) : n * (m + 1) = n * m + n",
"start": [
203,
1
],
"end": [
204,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_mul",
"code": "@[simp] protected theorem zero_mul : ∀ (n : Nat), 0 * n = 0",
"start": [
206,
1
],
"end": [
208,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_mul",
"code": "theorem succ_mul (n m : Nat) : (succ n) * m = (n * m) + m",
"start": [
210,
1
],
"end": [
213,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_mul",
"code": "theorem add_one_mul (n m : Nat) : (n + 1) * m = (n * m) + m",
"start": [
215,
1
],
"end": [
215,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_comm",
"code": "protected theorem mul_comm : ∀ (n m : Nat), n * m = m * n",
"start": [
217,
1
],
"end": [
219,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_one",
"code": "@[simp] protected theorem mul_one : ∀ (n : Nat), n * 1 = n",
"start": [
222,
1
],
"end": [
223,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_mul",
"code": "@[simp] protected theorem one_mul (n : Nat) : 1 * n = n",
"start": [
225,
1
],
"end": [
226,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.left_distrib",
"code": "protected theorem left_distrib (n m k : Nat) : n * (m + k) = n * m + n * k",
"start": [
231,
1
],
"end": [
234,
119
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.right_distrib",
"code": "protected theorem right_distrib (n m k : Nat) : (n + m) * k = n * k + m * k",
"start": [
236,
1
],
"end": [
237,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_add",
"code": "protected theorem mul_add (n m k : Nat) : n * (m + k) = n * m + n * k",
"start": [
239,
1
],
"end": [
240,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mul",
"code": "protected theorem add_mul (n m k : Nat) : (n + m) * k = n * k + m * k",
"start": [
242,
1
],
"end": [
243,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_assoc",
"code": "protected theorem mul_assoc : ∀ (n m k : Nat), (n * m) * k = n * (m * k)",
"start": [
245,
1
],
"end": [
247,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_left_comm",
"code": "protected theorem mul_left_comm (n m k : Nat) : n * (m * k) = m * (n * k)",
"start": [
250,
1
],
"end": [
251,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_two",
"code": "protected theorem mul_two (n) : n * 2 = n + n",
"start": [
253,
1
],
"end": [
253,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.two_mul",
"code": "protected theorem two_mul (n) : 2 * n = n + n",
"start": [
254,
1
],
"end": [
254,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_lt_succ",
"code": "theorem succ_lt_succ {n m : Nat} : n < m → succ n < succ m",
"start": [
260,
1
],
"end": [
260,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ_of_le",
"code": "theorem lt_succ_of_le {n m : Nat} : n ≤ m → n < succ m",
"start": [
262,
1
],
"end": [
262,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_lt_add_one",
"code": "theorem le_of_lt_add_one {n m : Nat} : n < m + 1 → n ≤ m",
"start": [
264,
1
],
"end": [
264,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_one_of_le",
"code": "theorem lt_add_one_of_le {n m : Nat} : n ≤ m → n < m + 1",
"start": [
266,
1
],
"end": [
266,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_zero",
"code": "@[simp] protected theorem sub_zero (n : Nat) : n - 0 = n",
"start": [
268,
1
],
"end": [
268,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_add_one_le_zero",
"code": "theorem not_add_one_le_zero (n : Nat) : ¬ n + 1 ≤ 0",
"start": [
270,
1
],
"end": [
270,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_add_one_le_self",
"code": "theorem not_add_one_le_self : (n : Nat) → ¬ n + 1 ≤ n",
"start": [
272,
1
],
"end": [
272,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_pos",
"code": "theorem add_one_pos (n : Nat) : 0 < n + 1",
"start": [
274,
1
],
"end": [
274,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_sub_succ_eq_sub",
"code": "theorem succ_sub_succ_eq_sub (n m : Nat) : succ n - succ m = n - m",
"start": [
276,
1
],
"end": [
279,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_le",
"code": "theorem pred_le : ∀ (n : Nat), pred n ≤ n",
"start": [
281,
1
],
"end": [
283,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_lt",
"code": "theorem pred_lt : ∀ {n : Nat}, n ≠ 0 → pred n < n",
"start": [
285,
1
],
"end": [
287,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_lt",
"code": "theorem sub_one_lt : ∀ {n : Nat}, n ≠ 0 → n - 1 < n",
"start": [
289,
1
],
"end": [
289,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le",
"code": "@[simp] theorem sub_le (n m : Nat) : n - m ≤ n",
"start": [
291,
1
],
"end": [
294,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt",
"code": "theorem sub_lt : ∀ {n m : Nat}, 0 < n → 0 < m → n - m < n",
"start": [
296,
1
],
"end": [
302,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_succ",
"code": "theorem sub_succ (n m : Nat) : n - succ m = pred (n - m)",
"start": [
304,
1
],
"end": [
304,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_sub_succ",
"code": "theorem succ_sub_succ (n m : Nat) : succ n - succ m = n - m",
"start": [
306,
1
],
"end": [
307,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_self",
"code": "@[simp] protected theorem sub_self : ∀ (n : Nat), n - n = 0",
"start": [
309,
1
],
"end": [
311,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_eq",
"code": "theorem sub_add_eq (a b c : Nat) : a - (b + c) = a - b - c",
"start": [
313,
1
],
"end": [
316,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_lt_of_le",
"code": "protected theorem lt_of_lt_of_le {n m k : Nat} : n < m → m ≤ k → n < k",
"start": [
318,
1
],
"end": [
319,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_lt_of_eq",
"code": "protected theorem lt_of_lt_of_eq {n m k : Nat} : n < m → m = k → n < k",
"start": [
321,
1
],
"end": [
322,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_eq",
"code": "protected theorem le_of_eq {n m : Nat} (p : n = m) : n ≤ m",
"start": [
336,
1
],
"end": [
337,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt.step",
"code": "theorem lt.step {n m : Nat} : n < m → n < succ m",
"start": [
339,
1
],
"end": [
339,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_succ_le",
"code": "theorem le_of_succ_le {n m : Nat} (h : succ n ≤ m) : n ≤ m",
"start": [
341,
1
],
"end": [
341,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_succ_lt",
"code": "theorem lt_of_succ_lt {n m : Nat} : succ n < m → n < m",
"start": [
342,
1
],
"end": [
342,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_lt",
"code": "protected theorem le_of_lt {n m : Nat} : n < m → n ≤ m",
"start": [
343,
1
],
"end": [
343,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_succ_lt_succ",
"code": "theorem lt_of_succ_lt_succ {n m : Nat} : succ n < succ m → n < m",
"start": [
345,
1
],
"end": [
345,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_succ_le",
"code": "theorem lt_of_succ_le {n m : Nat} (h : succ n ≤ m) : n < m",
"start": [
347,
1
],
"end": [
347,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_le_of_lt",
"code": "theorem succ_le_of_lt {n m : Nat} (h : n < m) : succ n ≤ m",
"start": [
348,
1
],
"end": [
348,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_or_pos",
"code": "theorem eq_zero_or_pos : ∀ (n : Nat), n = 0 ∨ n > 0",
"start": [
350,
1
],
"end": [
352,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_ne_zero",
"code": "protected theorem pos_of_ne_zero {n : Nat} : n ≠ 0 → 0 < n",
"start": [
354,
1
],
"end": [
354,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt.base",
"code": "theorem lt.base (n : Nat) : n < succ n",
"start": [
356,
1
],
"end": [
356,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ_self",
"code": "@[simp] theorem lt_succ_self (n : Nat) : n < succ n",
"start": [
358,
1
],
"end": [
358,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_one",
"code": "@[simp] protected theorem lt_add_one (n : Nat) : n < n + 1",
"start": [
360,
1
],
"end": [
360,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_total",
"code": "protected theorem le_total (m n : Nat) : m ≤ n ∨ n ≤ m",
"start": [
362,
1
],
"end": [
365,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_le_zero",
"code": "theorem eq_zero_of_le_zero {n : Nat} (h : n ≤ 0) : n = 0",
"start": [
367,
1
],
"end": [
367,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_of_lt",
"code": "theorem zero_lt_of_lt : {a b : Nat} → a < b → 0 < b",
"start": [
369,
1
],
"end": [
373,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_of_ne_zero",
"code": "theorem zero_lt_of_ne_zero {a : Nat} (h : a ≠ 0) : 0 < a",
"start": [
375,
1
],
"end": [
378,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_of_lt",
"code": "theorem ne_of_lt {a b : Nat} (h : a < b) : a ≠ b",
"start": [
382,
1
],
"end": [
382,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_or_eq_of_le_succ",
"code": "theorem le_or_eq_of_le_succ {m n : Nat} (h : m ≤ succ n) : m ≤ n ∨ m = succ n",
"start": [
384,
1
],
"end": [
390,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_or_eq_of_le_add_one",
"code": "theorem le_or_eq_of_le_add_one {m n : Nat} (h : m ≤ n + 1) : m ≤ n ∨ m = n + 1",
"start": [
392,
1
],
"end": [
393,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_add_right",
"code": "theorem le_add_right : ∀ (n k : Nat), n ≤ n + k",
"start": [
395,
1
],
"end": [
397,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_add_left",
"code": "theorem le_add_left (n m : Nat): n ≤ m + n",
"start": [
399,
1
],
"end": [
400,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_add_right_le",
"code": "theorem le_of_add_right_le {n m k : Nat} (h : n + k ≤ m) : n ≤ m",
"start": [
402,
1
],
"end": [
403,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_add_right_of_le",
"code": "theorem le_add_right_of_le {n m k : Nat} (h : n ≤ m) : n ≤ m + k",
"start": [
405,
1
],
"end": [
406,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_add_one_le",
"code": "theorem lt_of_add_one_le {n m : Nat} (h : n + 1 ≤ m) : n < m",
"start": [
408,
1
],
"end": [
408,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_le_of_lt",
"code": "theorem add_one_le_of_lt {n m : Nat} (h : n < m) : n + 1 ≤ m",
"start": [
410,
1
],
"end": [
410,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_left",
"code": "protected theorem lt_add_left (c : Nat) (h : a < b) : a < c + b",
"start": [
412,
1
],
"end": [
413,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_right",
"code": "protected theorem lt_add_right (c : Nat) (h : a < b) : a < b + c",
"start": [
415,
1
],
"end": [
416,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_add_right_lt",
"code": "theorem lt_of_add_right_lt {n m k : Nat} (h : n + k < m) : n < m",
"start": [
418,
1
],
"end": [
419,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le.dest",
"code": "theorem le.dest : ∀ {n m : Nat}, n ≤ m → Exists (fun k => n + k = m)",
"start": [
421,
1
],
"end": [
429,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le.intro",
"code": "theorem le.intro {n m k : Nat} (h : n + k = m) : n ≤ m",
"start": [
431,
1
],
"end": [
432,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_le_of_gt",
"code": "protected theorem not_le_of_gt {n m : Nat} (h : n > m) : ¬ n ≤ m",
"start": [
434,
1
],
"end": [
439,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_le_of_lt",
"code": "protected theorem not_le_of_lt : ∀{a b : Nat}, a < b → ¬(b ≤ a)",
"start": [
440,
1
],
"end": [
440,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_of_ge",
"code": "protected theorem not_lt_of_ge : ∀{a b : Nat}, b ≥ a → ¬(b < a)",
"start": [
441,
1
],
"end": [
441,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_of_le",
"code": "protected theorem not_lt_of_le : ∀{a b : Nat}, a ≤ b → ¬(b < a)",
"start": [
442,
1
],
"end": [
442,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_le_asymm",
"code": "protected theorem lt_le_asymm : ∀{a b : Nat}, a < b → ¬(b ≤ a)",
"start": [
443,
1
],
"end": [
443,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_lt_asymm",
"code": "protected theorem le_lt_asymm : ∀{a b : Nat}, a ≤ b → ¬(b < a)",
"start": [
444,
1
],
"end": [
444,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gt_of_not_le",
"code": "theorem gt_of_not_le {n m : Nat} (h : ¬ n ≤ m) : n > m",
"start": [
446,
1
],
"end": [
446,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_not_ge",
"code": "protected theorem lt_of_not_ge : ∀{a b : Nat}, ¬(b ≥ a) → b < a",
"start": [
447,
1
],
"end": [
447,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_not_le",
"code": "protected theorem lt_of_not_le : ∀{a b : Nat}, ¬(a ≤ b) → b < a",
"start": [
448,
1
],
"end": [
448,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ge_of_not_lt",
"code": "theorem ge_of_not_lt {n m : Nat} (h : ¬ n < m) : n ≥ m",
"start": [
450,
1
],
"end": [
450,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_not_gt",
"code": "protected theorem le_of_not_gt : ∀{a b : Nat}, ¬(b > a) → b ≤ a",
"start": [
451,
1
],
"end": [
451,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_not_lt",
"code": "protected theorem le_of_not_lt : ∀{a b : Nat}, ¬(a < b) → b ≤ a",
"start": [
452,
1
],
"end": [
452,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_of_gt",
"code": "theorem ne_of_gt {a b : Nat} (h : b < a) : a ≠ b",
"start": [
454,
1
],
"end": [
454,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_of_lt'",
"code": "protected theorem ne_of_lt' : ∀{a b : Nat}, a < b → b ≠ a",
"start": [
455,
1
],
"end": [
455,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_le",
"code": "@[simp] protected theorem not_le {a b : Nat} : ¬ a ≤ b ↔ b < a",
"start": [
457,
1
],
"end": [
458,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt",
"code": "@[simp] protected theorem not_lt {a b : Nat} : ¬ a < b ↔ b ≤ a",
"start": [
459,
1
],
"end": [
460,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_not_le",
"code": "protected theorem le_of_not_le {a b : Nat} (h : ¬ b ≤ a) : a ≤ b",
"start": [
462,
1
],
"end": [
462,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_not_ge",
"code": "protected theorem le_of_not_ge : ∀{a b : Nat}, ¬(a ≥ b) → a ≤ b",
"start": [
463,
1
],
"end": [
463,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_trichotomy",
"code": "protected theorem lt_trichotomy (a b : Nat) : a < b ∨ a = b ∨ b < a",
"start": [
465,
1
],
"end": [
471,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_or_gt_of_ne",
"code": "protected theorem lt_or_gt_of_ne {a b : Nat} (ne : a ≠ b) : a < b ∨ a > b",
"start": [
473,
1
],
"end": [
477,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_or_lt_of_ne",
"code": "protected theorem lt_or_lt_of_ne : ∀{a b : Nat}, a ≠ b → a < b ∨ b < a",
"start": [
479,
1
],
"end": [
479,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_antisymm_iff",
"code": "protected theorem le_antisymm_iff {a b : Nat} : a = b ↔ a ≤ b ∧ b ≤ a",
"start": [
481,
1
],
"end": [
483,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_iff_le_and_ge",
"code": "protected theorem eq_iff_le_and_ge : ∀{a b : Nat}, a = b ↔ a ≤ b ∧ b ≤ a",
"start": [
484,
1
],
"end": [
484,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_add_left",
"code": "protected theorem add_le_add_left {n m : Nat} (h : n ≤ m) (k : Nat) : k + n ≤ k + m",
"start": [
492,
1
],
"end": [
497,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_add_right",
"code": "protected theorem add_le_add_right {n m : Nat} (h : n ≤ m) (k : Nat) : n + k ≤ m + k",
"start": [
499,
1
],
"end": [
502,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_left",
"code": "protected theorem add_lt_add_left {n m : Nat} (h : n < m) (k : Nat) : k + n < k + m",
"start": [
504,
1
],
"end": [
505,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_right",
"code": "protected theorem add_lt_add_right {n m : Nat} (h : n < m) (k : Nat) : n + k < m + k",
"start": [
507,
1
],
"end": [
508,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_of_pos_right",
"code": "protected theorem lt_add_of_pos_right (h : 0 < k) : n < n + k",
"start": [
510,
1
],
"end": [
511,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_one",
"code": "protected theorem zero_lt_one : 0 < (1:Nat)",
"start": [
513,
1
],
"end": [
514,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_iff_ne_zero",
"code": "protected theorem pos_iff_ne_zero : 0 < n ↔ n ≠ 0",
"start": [
516,
1
],
"end": [
516,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_add",
"code": "theorem add_le_add {a b c d : Nat} (h₁ : a ≤ b) (h₂ : c ≤ d) : a + c ≤ b + d",
"start": [
518,
1
],
"end": [
519,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add",
"code": "theorem add_lt_add {a b c d : Nat} (h₁ : a < b) (h₂ : c < d) : a + c < b + d",
"start": [
521,
1
],
"end": [
522,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_add_le_add_left",
"code": "protected theorem le_of_add_le_add_left {a b c : Nat} (h : a + b ≤ a + c) : b ≤ c",
"start": [
524,
1
],
"end": [
529,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_add_le_add_right",
"code": "protected theorem le_of_add_le_add_right {a b c : Nat} : a + b ≤ c + b → a ≤ c",
"start": [
531,
1
],
"end": [
533,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_add_iff_right",
"code": "protected theorem add_le_add_iff_right {n : Nat} : m + n ≤ k + n ↔ m ≤ k",
"start": [
535,
1
],
"end": [
536,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_asymm",
"code": "protected theorem lt_asymm {a b : Nat} (h : a < b) : ¬ b < a",
"start": [
540,
1
],
"end": [
540,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_of_gt",
"code": "protected abbrev not_lt_of_gt := @Nat.lt_asymm",
"start": [
541,
1
],
"end": [
542,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_of_lt",
"code": "protected abbrev not_lt_of_lt := @Nat.lt_asymm",
"start": [
543,
1
],
"end": [
544,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_iff_le_not_le",
"code": "protected theorem lt_iff_le_not_le {m n : Nat} : m < n ↔ m ≤ n ∧ ¬ n ≤ m",
"start": [
546,
1
],
"end": [
547,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_iff_le_and_not_ge",
"code": "protected abbrev lt_iff_le_and_not_ge := @Nat.lt_iff_le_not_le",
"start": [
548,
1
],
"end": [
549,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_iff_le_and_ne",
"code": "protected theorem lt_iff_le_and_ne {m n : Nat} : m < n ↔ m ≤ n ∧ m ≠ n",
"start": [
551,
1
],
"end": [
552,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_iff_lt_or_gt",
"code": "protected theorem ne_iff_lt_or_gt {a b : Nat} : a ≠ b ↔ a < b ∨ b < a",
"start": [
554,
1
],
"end": [
555,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_or_gt",
"code": "protected abbrev lt_or_gt := @Nat.ne_iff_lt_or_gt",
"start": [
556,
1
],
"end": [
557,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_or_ge",
"code": "protected abbrev le_or_ge := @Nat.le_total",
"start": [
559,
1
],
"end": [
560,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_or_le",
"code": "protected abbrev le_or_le := @Nat.le_total",
"start": [
561,
1
],
"end": [
562,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_or_lt_of_not_lt",
"code": "protected theorem eq_or_lt_of_not_lt {a b : Nat} (hnlt : ¬ a < b) : a = b ∨ b < a",
"start": [
564,
1
],
"end": [
565,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_or_eq_of_le",
"code": "protected theorem lt_or_eq_of_le {n m : Nat} (h : n ≤ m) : n < m ∨ n = m",
"start": [
567,
1
],
"end": [
568,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_iff_lt_or_eq",
"code": "protected theorem le_iff_lt_or_eq {n m : Nat} : n ≤ m ↔ n < m ∨ n = m",
"start": [
570,
1
],
"end": [
571,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ_iff",
"code": "protected theorem lt_succ_iff : m < succ n ↔ m ≤ n",
"start": [
573,
1
],
"end": [
573,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_one_iff",
"code": "protected theorem lt_add_one_iff : m < n + 1 ↔ m ≤ n",
"start": [
575,
1
],
"end": [
575,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ_iff_lt_or_eq",
"code": "protected theorem lt_succ_iff_lt_or_eq : m < succ n ↔ m < n ∨ m = n",
"start": [
577,
1
],
"end": [
578,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_one_iff_lt_or_eq",
"code": "protected theorem lt_add_one_iff_lt_or_eq : m < n + 1 ↔ m < n ∨ m = n",
"start": [
580,
1
],
"end": [
581,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_of_lt_succ_of_not_lt",
"code": "protected theorem eq_of_lt_succ_of_not_lt (hmn : m < n + 1) (h : ¬ m < n) : m = n",
"start": [
583,
1
],
"end": [
584,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_of_le_of_lt_succ",
"code": "protected theorem eq_of_le_of_lt_succ (h₁ : n ≤ m) (h₂ : m < n + 1) : m = n",
"start": [
586,
1
],
"end": [
587,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_zero",
"code": "theorem le_zero : i ≤ 0 ↔ i = 0",
"start": [
592,
1
],
"end": [
592,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_pos",
"code": "protected abbrev one_pos := @Nat.zero_lt_one",
"start": [
594,
1
],
"end": [
595,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.two_pos",
"code": "protected theorem two_pos : 0 < 2",
"start": [
597,
1
],
"end": [
597,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_zero_iff_zero_lt",
"code": "protected theorem ne_zero_iff_zero_lt : n ≠ 0 ↔ 0 < n",
"start": [
599,
1
],
"end": [
599,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_two",
"code": "protected theorem zero_lt_two : 0 < 2",
"start": [
601,
1
],
"end": [
601,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_lt_two",
"code": "protected theorem one_lt_two : 1 < 2",
"start": [
603,
1
],
"end": [
603,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_not_pos",
"code": "protected theorem eq_zero_of_not_pos (h : ¬0 < n) : n = 0",
"start": [
605,
1
],
"end": [
606,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_ne_self",
"code": "theorem succ_ne_self (n) : succ n ≠ n",
"start": [
612,
1
],
"end": [
612,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_ne_self",
"code": "theorem add_one_ne_self (n) : n + 1 ≠ n",
"start": [
614,
1
],
"end": [
614,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_le",
"code": "theorem succ_le : succ n ≤ m ↔ n < m",
"start": [
616,
1
],
"end": [
616,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_le_iff",
"code": "theorem add_one_le_iff : n + 1 ≤ m ↔ n < m",
"start": [
618,
1
],
"end": [
618,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ",
"code": "theorem lt_succ : m < succ n ↔ m ≤ n",
"start": [
620,
1
],
"end": [
620,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_succ_of_lt",
"code": "theorem lt_succ_of_lt (h : a < b) : a < succ b",
"start": [
622,
1
],
"end": [
622,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_one_of_lt",
"code": "theorem lt_add_one_of_lt (h : a < b) : a < b + 1",
"start": [
624,
1
],
"end": [
624,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_pred_eq_of_ne_zero",
"code": "theorem succ_pred_eq_of_ne_zero : ∀ {n}, n ≠ 0 → succ (pred n) = n",
"start": [
626,
1
],
"end": [
627,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_or_eq_succ_pred",
"code": "theorem eq_zero_or_eq_succ_pred : ∀ n, n = 0 ∨ n = succ (pred n)",
"start": [
629,
1
],
"end": [
631,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_inj'",
"code": "theorem succ_inj' : succ a = succ b ↔ a = b",
"start": [
633,
1
],
"end": [
633,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_le_succ_iff",
"code": "theorem succ_le_succ_iff : succ a ≤ succ b ↔ a ≤ b",
"start": [
635,
1
],
"end": [
635,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_lt_succ_iff",
"code": "theorem succ_lt_succ_iff : succ a < succ b ↔ a < b",
"start": [
637,
1
],
"end": [
637,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_inj",
"code": "theorem add_one_inj : a + 1 = b + 1 ↔ a = b",
"start": [
639,
1
],
"end": [
639,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_le_add_one_iff",
"code": "theorem add_one_le_add_one_iff : a + 1 ≤ b + 1 ↔ a ≤ b",
"start": [
641,
1
],
"end": [
641,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_lt_add_one_iff",
"code": "theorem add_one_lt_add_one_iff : a + 1 < b + 1 ↔ a < b",
"start": [
643,
1
],
"end": [
643,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_inj",
"code": "theorem pred_inj : ∀ {a b}, 0 < a → 0 < b → pred a = pred b → a = b",
"start": [
645,
1
],
"end": [
646,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_ne_self",
"code": "theorem pred_ne_self : ∀ {a}, a ≠ 0 → pred a ≠ a",
"start": [
648,
1
],
"end": [
649,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_ne_self",
"code": "theorem sub_one_ne_self : ∀ {a}, a ≠ 0 → a - 1 ≠ a",
"start": [
651,
1
],
"end": [
652,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_lt_self",
"code": "theorem pred_lt_self : ∀ {a}, 0 < a → pred a < a",
"start": [
654,
1
],
"end": [
655,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_lt_pred",
"code": "theorem pred_lt_pred : ∀ {n m}, n ≠ 0 → n < m → pred n < pred m",
"start": [
657,
1
],
"end": [
658,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_le_iff_le_succ",
"code": "theorem pred_le_iff_le_succ : ∀ {n m}, pred n ≤ m ↔ n ≤ succ m",
"start": [
660,
1
],
"end": [
662,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_succ_of_pred_le",
"code": "theorem le_succ_of_pred_le : pred n ≤ m → n ≤ succ m",
"start": [
664,
1
],
"end": [
664,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_le_of_le_succ",
"code": "theorem pred_le_of_le_succ : n ≤ succ m → pred n ≤ m",
"start": [
666,
1
],
"end": [
666,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_pred_iff_succ_lt",
"code": "theorem lt_pred_iff_succ_lt : ∀ {n m}, n < pred m ↔ succ n < m",
"start": [
668,
1
],
"end": [
670,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_lt_of_lt_pred",
"code": "theorem succ_lt_of_lt_pred : n < pred m → succ n < m",
"start": [
672,
1
],
"end": [
672,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_pred_of_succ_lt",
"code": "theorem lt_pred_of_succ_lt : succ n < m → n < pred m",
"start": [
674,
1
],
"end": [
674,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_pred_iff_lt",
"code": "theorem le_pred_iff_lt : ∀ {n m}, 0 < m → (n ≤ pred m ↔ n < m)",
"start": [
676,
1
],
"end": [
678,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_pred_of_lt",
"code": "theorem le_pred_of_lt (h : n < m) : n ≤ pred m",
"start": [
680,
1
],
"end": [
680,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_one_of_lt",
"code": "theorem le_sub_one_of_lt : a < b → a ≤ b - 1",
"start": [
682,
1
],
"end": [
682,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_le_pred",
"code": "theorem lt_of_le_pred (h : 0 < m) : n ≤ pred m → n < m",
"start": [
684,
1
],
"end": [
684,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_le_sub_one",
"code": "theorem lt_of_le_sub_one (h : 0 < m) : n ≤ m - 1 → n < m",
"start": [
686,
1
],
"end": [
686,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_one_iff_lt",
"code": "protected theorem le_sub_one_iff_lt (h : 0 < m) : n ≤ m - 1 ↔ n < m",
"start": [
688,
1
],
"end": [
689,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.exists_eq_succ_of_ne_zero",
"code": "theorem exists_eq_succ_of_ne_zero : ∀ {n}, n ≠ 0 → Exists fun k => n = succ k",
"start": [
691,
1
],
"end": [
692,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.exists_eq_add_one_of_ne_zero",
"code": "theorem exists_eq_add_one_of_ne_zero : ∀ {n}, n ≠ 0 → Exists fun k => n = k + 1",
"start": [
694,
1
],
"end": [
695,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ctor_eq_zero",
"code": "theorem ctor_eq_zero : Nat.zero = 0",
"start": [
699,
1
],
"end": [
700,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_ne_zero",
"code": "protected theorem one_ne_zero : 1 ≠ (0 : Nat)",
"start": [
702,
1
],
"end": [
703,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_ne_one",
"code": "protected theorem zero_ne_one : 0 ≠ (1 : Nat)",
"start": [
705,
1
],
"end": [
706,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_ne_zero",
"code": "@[simp] theorem succ_ne_zero (n : Nat) : succ n ≠ 0",
"start": [
708,
1
],
"end": [
709,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_mul_left",
"code": "theorem mul_le_mul_left {n m : Nat} (k : Nat) (h : n ≤ m) : k * n ≤ k * m",
"start": [
713,
1
],
"end": [
717,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_mul_right",
"code": "theorem mul_le_mul_right {n m : Nat} (k : Nat) (h : n ≤ m) : n * k ≤ m * k",
"start": [
719,
1
],
"end": [
720,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_mul",
"code": "protected theorem mul_le_mul {n₁ m₁ n₂ m₂ : Nat} (h₁ : n₁ ≤ n₂) (h₂ : m₁ ≤ m₂) : n₁ * m₁ ≤ n₂ * m₂",
"start": [
722,
1
],
"end": [
723,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_pos_left",
"code": "protected theorem mul_lt_mul_of_pos_left {n m k : Nat} (h : n < m) (hk : k > 0) : k * n < k * m",
"start": [
725,
1
],
"end": [
726,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_pos_right",
"code": "protected theorem mul_lt_mul_of_pos_right {n m k : Nat} (h : n < m) (hk : k > 0) : n * k < m * k",
"start": [
728,
1
],
"end": [
729,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pos",
"code": "protected theorem mul_pos {n m : Nat} (ha : n > 0) (hb : m > 0) : n * m > 0",
"start": [
731,
1
],
"end": [
733,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_mul_le_mul_left",
"code": "protected theorem le_of_mul_le_mul_left {a b c : Nat} (h : c * a ≤ c * b) (hc : 0 < c) : a ≤ b",
"start": [
735,
1
],
"end": [
738,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_of_mul_eq_mul_left",
"code": "protected theorem eq_of_mul_eq_mul_left {m k n : Nat} (hn : 0 < n) (h : n * m = n * k) : m = k",
"start": [
740,
1
],
"end": [
742,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_of_mul_eq_mul_right",
"code": "theorem eq_of_mul_eq_mul_right {n m k : Nat} (hm : 0 < m) (h : n * m = k * m) : n = k",
"start": [
744,
1
],
"end": [
745,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_succ",
"code": "protected theorem pow_succ (n m : Nat) : n^(succ m) = n^m * n",
"start": [
749,
1
],
"end": [
750,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_add_one",
"code": "protected theorem pow_add_one (n m : Nat) : n^(m + 1) = n^m * n",
"start": [
752,
1
],
"end": [
753,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_zero",
"code": "protected theorem pow_zero (n : Nat) : n^0 = 1",
"start": [
755,
1
],
"end": [
755,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_of_le_left",
"code": "theorem pow_le_pow_of_le_left {n m : Nat} (h : n ≤ m) : ∀ (i : Nat), n^i ≤ m^i",
"start": [
757,
1
],
"end": [
759,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_of_le_right",
"code": "theorem pow_le_pow_of_le_right {n : Nat} (hx : n > 0) {i : Nat} : ∀ {j}, i ≤ j → n^i ≤ n^j",
"start": [
761,
1
],
"end": [
771,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_pow_of_pos",
"code": "theorem pos_pow_of_pos {n : Nat} (m : Nat) (h : 0 < n) : 0 < n^m",
"start": [
773,
1
],
"end": [
774,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min",
"code": "protected abbrev min (n m : Nat) := min n m",
"start": [
778,
1
],
"end": [
783,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_def",
"code": "protected theorem min_def {n m : Nat} : min n m = if n ≤ m then n else m",
"start": [
785,
1
],
"end": [
785,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max",
"code": "protected abbrev max (n m : Nat) := max n m",
"start": [
789,
1
],
"end": [
794,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_def",
"code": "protected theorem max_def {n m : Nat} : max n m = if n ≤ m then m else n",
"start": [
796,
1
],
"end": [
796,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_eq_zero_of_lt",
"code": "theorem not_eq_zero_of_lt (h : b < a) : a ≠ 0",
"start": [
801,
1
],
"end": [
804,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_lt_of_lt",
"code": "theorem pred_lt_of_lt {n m : Nat} (h : m < n) : pred n < n",
"start": [
806,
1
],
"end": [
807,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_lt'",
"code": "@[deprecated (since := \"2024-06-01\")] abbrev pred_lt' := @pred_lt_of_lt",
"start": [
810,
1
],
"end": [
810,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_lt_of_lt",
"code": "theorem sub_one_lt_of_lt {n m : Nat} (h : m < n) : n - 1 < n",
"start": [
812,
1
],
"end": [
813,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_zero",
"code": "@[simp] protected theorem pred_zero : pred 0 = 0",
"start": [
817,
1
],
"end": [
817,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_succ",
"code": "@[simp] protected theorem pred_succ (n : Nat) : pred n.succ = n",
"start": [
818,
1
],
"end": [
818,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_pred",
"code": "theorem succ_pred {a : Nat} (h : a ≠ 0) : a.pred.succ = a",
"start": [
820,
1
],
"end": [
823,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_add_one",
"code": "theorem sub_one_add_one {a : Nat} (h : a ≠ 0) : a - 1 + 1 = a",
"start": [
825,
1
],
"end": [
828,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_pred_eq_of_pos",
"code": "theorem succ_pred_eq_of_pos : ∀ {n}, 0 < n → succ (pred n) = n",
"start": [
830,
1
],
"end": [
831,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_add_one_eq_of_pos",
"code": "theorem sub_one_add_one_eq_of_pos : ∀ {n}, 0 < n → (n - 1) + 1 = n",
"start": [
833,
1
],
"end": [
834,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_or_eq_sub_one_add_one",
"code": "theorem eq_zero_or_eq_sub_one_add_one : ∀ {n}, n = 0 ∨ n = n - 1 + 1",
"start": [
836,
1
],
"end": [
838,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_eq_sub_one",
"code": "@[simp] theorem pred_eq_sub_one : pred n = n - 1",
"start": [
840,
1
],
"end": [
840,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_self_left",
"code": "theorem add_sub_self_left (a b : Nat) : (a + b) - a = b",
"start": [
844,
1
],
"end": [
849,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_self_right",
"code": "theorem add_sub_self_right (a b : Nat) : (a + b) - b = a",
"start": [
851,
1
],
"end": [
852,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_succ_sub",
"code": "theorem sub_le_succ_sub (a i : Nat) : a - i ≤ a.succ - i",
"start": [
854,
1
],
"end": [
857,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_lt_sub_of_lt",
"code": "theorem zero_lt_sub_of_lt (h : i < a) : 0 < a - i",
"start": [
859,
1
],
"end": [
867,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_succ_lt_self",
"code": "theorem sub_succ_lt_self (a i : Nat) (h : i < a) : a - (i + 1) < a - i",
"start": [
869,
1
],
"end": [
874,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_ne_zero_of_lt",
"code": "theorem sub_ne_zero_of_lt : {a b : Nat} → a < b → b - a ≠ 0",
"start": [
876,
1
],
"end": [
880,
103
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_of_le",
"code": "theorem add_sub_of_le {a b : Nat} (h : a ≤ b) : a + (b - a) = b",
"start": [
882,
1
],
"end": [
888,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_cancel",
"code": "theorem sub_one_cancel : ∀ {a b : Nat}, 0 < a → 0 < b → a - 1 = b - 1 → a = b",
"start": [
890,
1
],
"end": [
891,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_cancel",
"code": "@[simp] protected theorem sub_add_cancel {n m : Nat} (h : m ≤ n) : n - m + m = n",
"start": [
893,
1
],
"end": [
894,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_add_right",
"code": "protected theorem add_sub_add_right (n k m : Nat) : (n + k) - (m + k) = n - m",
"start": [
896,
1
],
"end": [
899,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_add_left",
"code": "protected theorem add_sub_add_left (k n m : Nat) : (k + n) - (k + m) = n - m",
"start": [
901,
1
],
"end": [
902,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_cancel",
"code": "@[simp] protected theorem add_sub_cancel (n m : Nat) : n + m - m = n",
"start": [
904,
1
],
"end": [
906,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_cancel_left",
"code": "protected theorem add_sub_cancel_left (n m : Nat) : n + m - n = m",
"start": [
908,
1
],
"end": [
910,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_assoc",
"code": "protected theorem add_sub_assoc {m k : Nat} (h : k ≤ m) (n : Nat) : n + m - k = n + (m - k)",
"start": [
912,
1
],
"end": [
915,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_add_of_sub_eq",
"code": "protected theorem eq_add_of_sub_eq {a b c : Nat} (hle : b ≤ a) (h : a - b = c) : a = c + b",
"start": [
917,
1
],
"end": [
918,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_of_eq_add",
"code": "protected theorem sub_eq_of_eq_add {a b c : Nat} (h : a = c + b) : a - b = c",
"start": [
920,
1
],
"end": [
921,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_add_of_sub_le",
"code": "theorem le_add_of_sub_le {a b c : Nat} (h : a - b ≤ c) : a ≤ c + b",
"start": [
923,
1
],
"end": [
931,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_sub_left",
"code": "protected theorem sub_lt_sub_left : ∀ {k m n : Nat}, k < m → k < n → m - n < m - k",
"start": [
933,
1
],
"end": [
937,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_sub",
"code": "@[simp] protected theorem zero_sub (n : Nat) : 0 - n = 0",
"start": [
939,
1
],
"end": [
942,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_sub_right",
"code": "protected theorem sub_lt_sub_right : ∀ {a b c : Nat}, c ≤ a → a < b → a - c < b - c",
"start": [
944,
1
],
"end": [
953,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_self_add",
"code": "protected theorem sub_self_add (n m : Nat) : n - (n + m) = 0",
"start": [
955,
1
],
"end": [
957,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_zero_of_le",
"code": "protected theorem sub_eq_zero_of_le {n m : Nat} (h : n ≤ m) : n - m = 0",
"start": [
959,
1
],
"end": [
961,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_of_le_add",
"code": "theorem sub_le_of_le_add {a b c : Nat} (h : a ≤ c + b) : a - b ≤ c",
"start": [
963,
1
],
"end": [
972,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_of_le_sub",
"code": "theorem add_le_of_le_sub {a b c : Nat} (hle : b ≤ c) (h : a ≤ c - b) : a + b ≤ c",
"start": [
974,
1
],
"end": [
979,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_of_add_le",
"code": "theorem le_sub_of_add_le {a b c : Nat} (h : a + b ≤ c) : a ≤ c - b",
"start": [
981,
1
],
"end": [
987,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_of_lt_sub",
"code": "theorem add_lt_of_lt_sub {a b c : Nat} (h : a < c - b) : a + b < c",
"start": [
989,
1
],
"end": [
998,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_sub_of_add_lt",
"code": "theorem lt_sub_of_add_lt {a b c : Nat} (h : a + b < c) : a < c - b",
"start": [
1000,
1
],
"end": [
1002,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub.elim",
"code": "theorem sub.elim {motive : Nat → Prop}\n (x y : Nat)\n (h₁ : y ≤ x → (k : Nat) → x = y + k → motive k)\n (h₂ : x < y → motive 0)\n : motive (x - y)",
"start": [
1004,
1
],
"end": [
1011,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_sub",
"code": "theorem succ_sub {m n : Nat} (h : n ≤ m) : succ m - n = succ (m - n)",
"start": [
1013,
1
],
"end": [
1015,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_pos_of_lt",
"code": "protected theorem sub_pos_of_lt (h : m < n) : 0 < n - m",
"start": [
1017,
1
],
"end": [
1018,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_sub",
"code": "protected theorem sub_sub (n m k : Nat) : n - m - k = n - (m + k)",
"start": [
1020,
1
],
"end": [
1023,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_sub_left",
"code": "protected theorem sub_le_sub_left (h : n ≤ m) (k : Nat) : k - m ≤ k - n",
"start": [
1025,
1
],
"end": [
1027,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_sub_right",
"code": "protected theorem sub_le_sub_right {n m : Nat} (h : n ≤ m) : ∀ k, n - k ≤ m - k",
"start": [
1029,
1
],
"end": [
1031,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_add_right_sub",
"code": "protected theorem sub_le_add_right_sub (a i j : Nat) : a - i ≤ a + j - i",
"start": [
1033,
1
],
"end": [
1034,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_sub_ne_zero",
"code": "protected theorem lt_of_sub_ne_zero (h : n - m ≠ 0) : m < n",
"start": [
1036,
1
],
"end": [
1037,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_ne_zero_iff_lt",
"code": "protected theorem sub_ne_zero_iff_lt : n - m ≠ 0 ↔ m < n",
"start": [
1039,
1
],
"end": [
1040,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_sub_pos",
"code": "protected theorem lt_of_sub_pos (h : 0 < n - m) : m < n",
"start": [
1042,
1
],
"end": [
1043,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_sub_eq_succ",
"code": "protected theorem lt_of_sub_eq_succ (h : m - n = succ l) : n < m",
"start": [
1045,
1
],
"end": [
1046,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_sub_eq_sub_one",
"code": "protected theorem lt_of_sub_eq_sub_one (h : m - n = l + 1) : n < m",
"start": [
1048,
1
],
"end": [
1049,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_left_of_lt_add",
"code": "protected theorem sub_lt_left_of_lt_add {n k m : Nat} (H : n ≤ k) (h : k < n + m) : k - n < m",
"start": [
1051,
1
],
"end": [
1053,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_right_of_lt_add",
"code": "protected theorem sub_lt_right_of_lt_add {n k m : Nat} (H : n ≤ k) (h : k < m + n) : k - n < m",
"start": [
1055,
1
],
"end": [
1056,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_sub_eq_zero",
"code": "protected theorem le_of_sub_eq_zero : ∀ {n m}, n - m = 0 → n ≤ m",
"start": [
1058,
1
],
"end": [
1060,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_sub_le_sub_right",
"code": "protected theorem le_of_sub_le_sub_right : ∀ {n m k : Nat}, k ≤ m → n - k ≤ m - k → n ≤ m",
"start": [
1062,
1
],
"end": [
1067,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_sub_iff_right",
"code": "protected theorem sub_le_sub_iff_right {n : Nat} (h : k ≤ m) : n - k ≤ m - k ↔ n ≤ m",
"start": [
1069,
1
],
"end": [
1070,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_iff_eq_add",
"code": "protected theorem sub_eq_iff_eq_add {c : Nat} (h : b ≤ a) : a - b = c ↔ a = c + b",
"start": [
1072,
1
],
"end": [
1073,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_iff_eq_add'",
"code": "protected theorem sub_eq_iff_eq_add' {c : Nat} (h : b ≤ a) : a - b = c ↔ a = b + c",
"start": [
1075,
1
],
"end": [
1076,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_mul",
"code": "theorem pred_mul (n m : Nat) : pred n * m = n * m - m",
"start": [
1080,
1
],
"end": [
1083,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pred_left",
"code": "@[deprecated (since := \"2024-06-01\")] abbrev mul_pred_left := @pred_mul",
"start": [
1086,
1
],
"end": [
1086,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_mul",
"code": "protected theorem sub_one_mul (n m : Nat) : (n - 1) * m = n * m - m",
"start": [
1088,
1
],
"end": [
1092,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pred",
"code": "theorem mul_pred (n m : Nat) : n * pred m = n * m - n",
"start": [
1094,
1
],
"end": [
1095,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pred_right",
"code": "@[deprecated (since := \"2024-06-01\")] abbrev mul_pred_right := @mul_pred",
"start": [
1098,
1
],
"end": [
1098,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_sub_one",
"code": "theorem mul_sub_one (n m : Nat) : n * (m - 1) = n * m - n",
"start": [
1100,
1
],
"end": [
1101,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_sub_right_distrib",
"code": "protected theorem mul_sub_right_distrib (n m k : Nat) : (n - m) * k = n * k - m * k",
"start": [
1103,
1
],
"end": [
1106,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_sub_left_distrib",
"code": "protected theorem mul_sub_left_distrib (n m k : Nat) : n * (m - k) = n * m - n * k",
"start": [
1108,
1
],
"end": [
1109,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_le_eq",
"code": "theorem not_le_eq (a b : Nat) : (¬ (a ≤ b)) = (b + 1 ≤ a)",
"start": [
1113,
1
],
"end": [
1114,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_ge_eq",
"code": "theorem not_ge_eq (a b : Nat) : (¬ (a ≥ b)) = (a + 1 ≤ b)",
"start": [
1115,
1
],
"end": [
1116,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_lt_eq",
"code": "theorem not_lt_eq (a b : Nat) : (¬ (a < b)) = (b ≤ a)",
"start": [
1118,
1
],
"end": [
1119,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.not_gt_eq",
"code": "theorem not_gt_eq (a b : Nat) : (¬ (a > b)) = (a ≤ b)",
"start": [
1120,
1
],
"end": [
1121,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.fold_eq_foldTR",
"code": "@[csimp] theorem fold_eq_foldTR : @fold = @foldTR",
"start": [
1125,
1
],
"end": [
1130,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.any_eq_anyTR",
"code": "@[csimp] theorem any_eq_anyTR : @any = @anyTR",
"start": [
1132,
1
],
"end": [
1139,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.all_eq_allTR",
"code": "@[csimp] theorem all_eq_allTR : @all = @allTR",
"start": [
1141,
1
],
"end": [
1148,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.repeat_eq_repeatTR",
"code": "@[csimp] theorem repeat_eq_repeatTR : @repeat = @repeatTR",
"start": [
1150,
1
],
"end": [
1155,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.foldI",
"code": "@[inline] def foldI {α : Type u} (f : Nat → α → α) (i : Nat × Nat) (a : α) : α :=\n Nat.foldTR.loop f i.2 (i.2 - i.1) a",
"start": [
1161,
1
],
"end": [
1167,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.anyI",
"code": "@[inline] def anyI (f : Nat → Bool) (i : Nat × Nat) : Bool :=\n Nat.anyTR.loop f i.2 (i.2 - i.1)",
"start": [
1169,
1
],
"end": [
1175,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.allI",
"code": "@[inline] def allI (f : Nat → Bool) (i : Nat × Nat) : Bool :=\n Nat.allTR.loop f i.2 (i.2 - i.1)",
"start": [
1177,
1
],
"end": [
1183,
35
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/MetaTypes.lean | [
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "Lean.NameGenerator",
"code": "structure NameGenerator where\n namePrefix : Name := `_uniq\n idx : Nat := 1\n deriving Inhabited",
"start": [
11,
1
],
"end": [
14,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Module",
"code": "structure Module where\n header : Syntax\n commands : Array Syntax",
"start": [
16,
1
],
"end": [
19,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.TransparencyMode",
"code": "inductive TransparencyMode where\n \n | all\n \n | default\n \n | reducible\n \n | instances\n deriving Inhabited, BEq",
"start": [
23,
1
],
"end": [
32,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.EtaStructMode",
"code": "inductive EtaStructMode where\n \n | all\n \n | notClasses\n \n | none\n deriving Inhabited, BEq",
"start": [
34,
1
],
"end": [
41,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.DSimp.Config",
"code": "structure Config where\n \n zeta : Bool := true\n \n beta : Bool := true\n \n eta : Bool := true\n \n etaStruct : EtaStructMode := .all\n \n iota : Bool := true\n \n proj : Bool := true\n \n decide : Bool := false\n \n autoUnfold : Bool := false\n \n failIfUnchanged : Bool := true\n \n unfoldPartialApp : Bool := false\n \n zetaDelta : Bool := false\n deriving Inhabited, BEq",
"start": [
45,
1
],
"end": [
107,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.Simp.defaultMaxSteps",
"code": "def defaultMaxSteps := 100000",
"start": [
113,
1
],
"end": [
113,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.Simp.Config",
"code": "structure Config where\n \n maxSteps : Nat := defaultMaxSteps\n \n maxDischargeDepth : Nat := 2\n \n contextual : Bool := false\n \n memoize : Bool := true\n \n singlePass : Bool := false\n \n zeta : Bool := true\n \n beta : Bool := true\n \n eta : Bool := true\n \n etaStruct : EtaStructMode := .all\n \n iota : Bool := true\n \n proj : Bool := true\n \n decide : Bool := false\n \n arith : Bool := false\n \n autoUnfold : Bool := false\n \n dsimp : Bool := true\n \n failIfUnchanged : Bool := true\n \n ground : Bool := false\n \n unfoldPartialApp : Bool := false\n \n zetaDelta : Bool := false\n \n index : Bool := true\n \n implicitDefEqProofs : Bool := false\n deriving Inhabited, BEq",
"start": [
115,
1
],
"end": [
229,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.Simp.ConfigCtx",
"code": "structure ConfigCtx extends Config where\n contextual := true",
"start": [
232,
1
],
"end": [
233,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.Simp.neutralConfig",
"code": "def neutralConfig : Simp.Config := {\n zeta := false\n beta := false\n eta := false\n iota := false\n proj := false\n decide := false\n arith := false\n autoUnfold := false\n ground := false\n zetaDelta := false\n}",
"start": [
235,
1
],
"end": [
249,
2
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Meta.Occurrences",
"code": "inductive Occurrences where\n | all\n | pos (idxs : List Nat)\n | neg (idxs : List Nat)\n deriving Inhabited, BEq",
"start": [
253,
1
],
"end": [
257,
26
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/WF.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean",
".lake/packages/lean4/src/lean/Init/SizeOf.lean"
] | [
{
"full_name": "Acc",
"code": "inductive Acc {α : Sort u} (r : α → α → Prop) : α → Prop where\n \n | intro (x : α) (h : (y : α) → r y x → Acc r y) : Acc r x",
"start": [
12,
1
],
"end": [
24,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Acc.ndrec",
"code": "noncomputable abbrev Acc.ndrec.{u1, u2} {α : Sort u2} {r : α → α → Prop} {C : α → Sort u1}\n (m : (x : α) → ((y : α) → r y x → Acc r y) → ((y : α) → (a : r y x) → C y) → C x)\n {a : α} (n : Acc r a) : C a :=\n n.rec m",
"start": [
26,
1
],
"end": [
29,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Acc.ndrecOn",
"code": "noncomputable abbrev Acc.ndrecOn.{u1, u2} {α : Sort u2} {r : α → α → Prop} {C : α → Sort u1}\n {a : α} (n : Acc r a)\n (m : (x : α) → ((y : α) → r y x → Acc r y) → ((y : α) → (a : r y x) → C y) → C x)\n : C a :=\n n.rec m",
"start": [
31,
1
],
"end": [
35,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Acc.inv",
"code": "theorem inv {x y : α} (h₁ : Acc r x) (h₂ : r y x) : Acc r y",
"start": [
40,
1
],
"end": [
41,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded",
"code": "inductive WellFounded {α : Sort u} (r : α → α → Prop) : Prop where\n | intro (h : ∀ a, Acc r a) : WellFounded r",
"start": [
45,
1
],
"end": [
54,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFoundedRelation",
"code": "class WellFoundedRelation (α : Sort u) where\n rel : α → α → Prop\n wf : WellFounded rel",
"start": [
56,
1
],
"end": [
58,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.apply",
"code": "theorem apply {α : Sort u} {r : α → α → Prop} (wf : WellFounded r) (a : α) : Acc r a",
"start": [
61,
1
],
"end": [
62,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.recursion",
"code": "noncomputable def recursion {C : α → Sort v} (a : α) (h : ∀ x, (∀ y, r y x → C y) → C x) : C a := by\n induction (apply hwf a) with\n | intro x₁ _ ih => exact h x₁ ih",
"start": [
67,
1
],
"end": [
69,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.induction",
"code": "theorem induction {C : α → Prop} (a : α) (h : ∀ x, (∀ y, r y x → C y) → C x) : C a",
"start": [
71,
1
],
"end": [
72,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.fixF",
"code": "noncomputable def fixF (x : α) (a : Acc r x) : C x := by\n induction a with\n | intro x₁ _ ih => exact F x₁ ih",
"start": [
77,
1
],
"end": [
79,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.fixFEq",
"code": "theorem fixFEq (x : α) (acx : Acc r x) : fixF F x acx = F x (fun (y : α) (p : r y x) => fixF F y (Acc.inv acx p))",
"start": [
81,
1
],
"end": [
83,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.fix",
"code": "noncomputable def fix (hwf : WellFounded r) (F : ∀ x, (∀ y, r y x → C y) → C x) (x : α) : C x :=\n fixF F x (apply hwf x)",
"start": [
90,
1
],
"end": [
91,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "WellFounded.fix_eq",
"code": "theorem fix_eq (hwf : WellFounded r) (F : ∀ x, (∀ y, r y x → C y) → C x) (x : α) :\n fix hwf F x = F x (fun y _ => fix hwf F y)",
"start": [
94,
1
],
"end": [
96,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "emptyWf",
"code": "def emptyWf {α : Sort u} : WellFoundedRelation α where\n rel := emptyRelation\n wf := by\n apply WellFounded.intro\n intro a\n apply Acc.intro a\n intro b h\n cases h",
"start": [
102,
1
],
"end": [
109,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Subrelation.accessible",
"code": "theorem accessible {a : α} (h₁ : Subrelation q r) (ac : Acc r a) : Acc q a",
"start": [
115,
1
],
"end": [
120,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Subrelation.wf",
"code": "theorem wf (h₁ : Subrelation q r) (h₂ : WellFounded r) : WellFounded q",
"start": [
122,
1
],
"end": [
123,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "InvImage.accAux",
"code": "private def accAux (f : α → β) {b : β} (ac : Acc r b) : (x : α) → f x = b → Acc (InvImage r f) x := by\n induction ac with\n | intro x acx ih =>\n intro z e\n apply Acc.intro\n intro y lt\n subst x\n apply ih (f y) lt y rfl",
"start": [
130,
1
],
"end": [
137,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "InvImage.accessible",
"code": "theorem accessible {a : α} (f : α → β) (ac : Acc r (f a)) : Acc (InvImage r f) a",
"start": [
139,
1
],
"end": [
140,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "InvImage.wf",
"code": "theorem wf (f : α → β) (h : WellFounded r) : WellFounded (InvImage r f)",
"start": [
142,
1
],
"end": [
143,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "invImage",
"code": "@[reducible] def invImage (f : α → β) (h : WellFoundedRelation β) : WellFoundedRelation α where\n rel := InvImage h.rel f\n wf := InvImage.wf f h.wf",
"start": [
146,
1
],
"end": [
148,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "TC.accessible",
"code": "theorem accessible {z : α} (ac : Acc r z) : Acc (TC r) z",
"start": [
154,
1
],
"end": [
161,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "TC.wf",
"code": "theorem wf (h : WellFounded r) : WellFounded (TC r)",
"start": [
163,
1
],
"end": [
164,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_wfRel",
"code": "def lt_wfRel : WellFoundedRelation Nat where\n rel := Nat.lt\n wf := by\n apply WellFounded.intro\n intro n\n induction n with\n | zero =>\n apply Acc.intro 0\n intro _ h\n apply absurd h (Nat.not_lt_zero _)\n | succ n ih =>\n apply Acc.intro (Nat.succ n)\n intro m h\n have : m = n ∨ m < n := Nat.eq_or_lt_of_le (Nat.le_of_succ_le_succ h)\n match this with\n | Or.inl e => subst e; assumption\n | Or.inr e => exact Acc.inv ih e",
"start": [
170,
1
],
"end": [
186,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.strongInductionOn",
"code": "protected noncomputable def strongInductionOn\n {motive : Nat → Sort u}\n (n : Nat)\n (ind : ∀ n, (∀ m, m < n → motive m) → motive n) : motive n :=\n Nat.lt_wfRel.wf.fix ind n",
"start": [
188,
1
],
"end": [
192,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.caseStrongInductionOn",
"code": "protected noncomputable def caseStrongInductionOn\n {motive : Nat → Sort u}\n (a : Nat)\n (zero : motive 0)\n (ind : ∀ n, (∀ m, m ≤ n → motive m) → motive (succ n)) : motive a :=\n Nat.strongInductionOn a fun n =>\n match n with\n | 0 => fun _ => zero\n | n+1 => fun h₁ => ind n (λ _ h₂ => h₁ _ (lt_succ_of_le h₂))",
"start": [
194,
1
],
"end": [
202,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "measure",
"code": "abbrev measure {α : Sort u} (f : α → Nat) : WellFoundedRelation α :=\n invImage f Nat.lt_wfRel",
"start": [
206,
1
],
"end": [
207,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "sizeOfWFRel",
"code": "abbrev sizeOfWFRel {α : Sort u} [SizeOf α] : WellFoundedRelation α :=\n measure sizeOf",
"start": [
209,
1
],
"end": [
210,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.Lex",
"code": "protected inductive Lex : α × β → α × β → Prop where\n | left {a₁} (b₁) {a₂} (b₂) (h : ra a₁ a₂) : Prod.Lex (a₁, b₁) (a₂, b₂)\n | right (a) {b₁ b₂} (h : rb b₁ b₂) : Prod.Lex (a, b₁) (a, b₂)",
"start": [
224,
1
],
"end": [
226,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lex_def",
"code": "theorem lex_def (r : α → α → Prop) (s : β → β → Prop) {p q : α × β} :\n Prod.Lex r s p q ↔ r p.1 q.1 ∨ p.1 = q.1 ∧ s p.2 q.2",
"start": [
228,
1
],
"end": [
233,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.Lex.right'",
"code": "theorem right' {a₁ : Nat} {b₁ : β} (h₁ : a₁ ≤ a₂) (h₂ : rb b₁ b₂) : Prod.Lex Nat.lt rb (a₁, b₁) (a₂, b₂)",
"start": [
254,
1
],
"end": [
257,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.RProd",
"code": "inductive RProd : α × β → α × β → Prop where\n | intro {a₁ b₁ a₂ b₂} (h₁ : ra a₁ a₂) (h₂ : rb b₁ b₂) : RProd (a₁, b₁) (a₂, b₂)",
"start": [
262,
1
],
"end": [
263,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lexAccessible",
"code": "theorem lexAccessible {a : α} (aca : Acc ra a) (acb : (b : β) → Acc rb b) (b : β) : Acc (Prod.Lex ra rb) (a, b)",
"start": [
271,
1
],
"end": [
280,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.lex",
"code": "@[reducible] def lex (ha : WellFoundedRelation α) (hb : WellFoundedRelation β) : WellFoundedRelation (α × β) where\n rel := Prod.Lex ha.rel hb.rel\n wf := ⟨fun (a, b) => lexAccessible (WellFounded.apply ha.wf a) (WellFounded.apply hb.wf) b⟩",
"start": [
283,
1
],
"end": [
285,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.RProdSubLex",
"code": "def RProdSubLex (a : α × β) (b : α × β) (h : RProd ra rb a b) : Prod.Lex ra rb a b := by\n cases h with\n | intro h₁ h₂ => exact Prod.Lex.left _ _ h₁",
"start": [
291,
1
],
"end": [
293,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.rprod",
"code": "def rprod (ha : WellFoundedRelation α) (hb : WellFoundedRelation β) : WellFoundedRelation (α × β) where\n rel := RProd ha.rel hb.rel\n wf := by\n apply Subrelation.wf (r := Prod.Lex ha.rel hb.rel) (h₂ := (lex ha hb).wf)\n intro a b h\n exact RProdSubLex a b h",
"start": [
296,
1
],
"end": [
301,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.Lex",
"code": "inductive Lex : PSigma β → PSigma β → Prop where\n | left : ∀ {a₁ : α} (b₁ : β a₁) {a₂ : α} (b₂ : β a₂), r a₁ a₂ → Lex ⟨a₁, b₁⟩ ⟨a₂, b₂⟩\n | right : ∀ (a : α) {b₁ b₂ : β a}, s a b₁ b₂ → Lex ⟨a, b₁⟩ ⟨a, b₂⟩",
"start": [
314,
1
],
"end": [
316,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.lexAccessible",
"code": "def lexAccessible {a} (aca : Acc r a) (acb : (a : α) → WellFounded (s a)) (b : β a) : Acc (Lex r s) ⟨a, b⟩ := by\n induction aca with\n | intro xa _ iha =>\n induction (WellFounded.apply (acb xa) b) with\n | intro xb _ ihb =>\n apply Acc.intro\n intro p lt\n cases lt with\n | left => apply iha; assumption\n | right => apply ihb; assumption",
"start": [
323,
1
],
"end": [
332,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.lex",
"code": "@[reducible] def lex (ha : WellFoundedRelation α) (hb : (a : α) → WellFoundedRelation (β a)) : WellFoundedRelation (PSigma β) where\n rel := Lex ha.rel (fun a => hb a |>.rel)\n wf := WellFounded.intro fun ⟨a, b⟩ => lexAccessible (WellFounded.apply ha.wf a) (fun a => hb a |>.wf) b",
"start": [
335,
1
],
"end": [
337,
107
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.lexNdep",
"code": "def lexNdep (r : α → α → Prop) (s : β → β → Prop) :=\n Lex r (fun _ => s)",
"start": [
347,
1
],
"end": [
348,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.lexNdepWf",
"code": "theorem lexNdepWf {r : α → α → Prop} {s : β → β → Prop} (ha : WellFounded r) (hb : WellFounded s) : WellFounded (lexNdep r s)",
"start": [
350,
1
],
"end": [
351,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.RevLex",
"code": "inductive RevLex (r : α → α → Prop) (s : β → β → Prop) : @PSigma α (fun _ => β) → @PSigma α (fun _ => β) → Prop where\n | left : {a₁ a₂ : α} → (b : β) → r a₁ a₂ → RevLex r s ⟨a₁, b⟩ ⟨a₂, b⟩\n | right : (a₁ : α) → {b₁ : β} → (a₂ : α) → {b₂ : β} → s b₁ b₂ → RevLex r s ⟨a₁, b₁⟩ ⟨a₂, b₂⟩",
"start": [
358,
1
],
"end": [
360,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.revLexAccessible",
"code": "theorem revLexAccessible {b} (acb : Acc s b) (aca : (a : α) → Acc r a): (a : α) → Acc (RevLex r s) ⟨a, b⟩",
"start": [
368,
1
],
"end": [
378,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.revLex",
"code": "theorem revLex (ha : WellFounded r) (hb : WellFounded s) : WellFounded (RevLex r s)",
"start": [
380,
1
],
"end": [
381,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.SkipLeft",
"code": "def SkipLeft (α : Type u) {β : Type v} (s : β → β → Prop) : @PSigma α (fun _ => β) → @PSigma α (fun _ => β) → Prop :=\n RevLex emptyRelation s",
"start": [
385,
1
],
"end": [
386,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.skipLeft",
"code": "def skipLeft (α : Type u) {β : Type v} (hb : WellFoundedRelation β) : WellFoundedRelation (PSigma fun _ : α => β) where\n rel := SkipLeft α hb.rel\n wf := revLex emptyWf.wf hb.wf",
"start": [
388,
1
],
"end": [
390,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.mkSkipLeft",
"code": "theorem mkSkipLeft {α : Type u} {β : Type v} {b₁ b₂ : β} {s : β → β → Prop} (a₁ a₂ : α) (h : s b₁ b₂) : SkipLeft α s ⟨a₁, b₁⟩ ⟨a₂, b₂⟩",
"start": [
392,
1
],
"end": [
393,
21
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/WFTactics.lean | [
".lake/packages/lean4/src/lean/Init/WF.lean",
".lake/packages/lean4/src/lean/Init/MetaTypes.lean",
".lake/packages/lean4/src/lean/Init/SizeOf.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean | [
".lake/packages/lean4/src/lean/Init/WF.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean",
".lake/packages/lean4/src/lean/Init/WFTactics.lean"
] | [
{
"full_name": "Nat.div_rec_lemma",
"code": "theorem div_rec_lemma {x y : Nat} : 0 < y ∧ y ≤ x → x - y < x",
"start": [
20,
1
],
"end": [
21,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div",
"code": "@[extern \"lean_nat_div\"]\nprotected def div (x y : @& Nat) : Nat :=\n if 0 < y ∧ y ≤ x then\n Nat.div (x - y) y + 1\n else\n 0\ndecreasing_by apply div_rec_lemma; assumption",
"start": [
23,
1
],
"end": [
29,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.instDiv",
"code": "instance instDiv : Div Nat := ⟨Nat.div⟩",
"start": [
31,
1
],
"end": [
31,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq",
"code": "theorem div_eq (x y : Nat) : x / y = if 0 < y ∧ y ≤ x then (x - y) / y + 1 else 0",
"start": [
33,
1
],
"end": [
36,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div.inductionOn",
"code": "def div.inductionOn.{u}\n {motive : Nat → Nat → Sort u}\n (x y : Nat)\n (ind : ∀ x y, 0 < y ∧ y ≤ x → motive (x - y) y → motive x y)\n (base : ∀ x y, ¬(0 < y ∧ y ≤ x) → motive x y)\n : motive x y :=\n if h : 0 < y ∧ y ≤ x then\n ind x y h (inductionOn (x - y) y ind base)\n else\n base x y h\ndecreasing_by apply div_rec_lemma; assumption",
"start": [
38,
1
],
"end": [
48,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_le_self",
"code": "theorem div_le_self (n k : Nat) : n / k ≤ n",
"start": [
50,
1
],
"end": [
62,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_lt_self",
"code": "theorem div_lt_self {n k : Nat} (hLtN : 0 < n) (hLtK : 1 < k) : n / k < n",
"start": [
64,
1
],
"end": [
73,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.modCore",
"code": "@[extern \"lean_nat_mod\"]\nprotected def modCore (x y : @& Nat) : Nat :=\n if 0 < y ∧ y ≤ x then\n Nat.modCore (x - y) y\n else\n x\ndecreasing_by apply div_rec_lemma; assumption",
"start": [
75,
1
],
"end": [
81,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod",
"code": "@[extern \"lean_nat_mod\"]\nprotected def mod : @& Nat → @& Nat → Nat\n \n | 0, _ => 0\n | n@(_ + 1), m =>\n if m ≤ n then Nat.modCore n m\n else n",
"start": [
83,
1
],
"end": [
98,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.instMod",
"code": "instance instMod : Mod Nat := ⟨Nat.mod⟩",
"start": [
100,
1
],
"end": [
100,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.modCore_eq_mod",
"code": "protected theorem modCore_eq_mod (n m : Nat) : Nat.modCore n m = n % m",
"start": [
102,
1
],
"end": [
112,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_eq",
"code": "theorem mod_eq (x y : Nat) : x % y = if 0 < y ∧ y ≤ x then (x - y) % y else x",
"start": [
114,
1
],
"end": [
115,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod.inductionOn",
"code": "def mod.inductionOn.{u}\n {motive : Nat → Nat → Sort u}\n (x y : Nat)\n (ind : ∀ x y, 0 < y ∧ y ≤ x → motive (x - y) y → motive x y)\n (base : ∀ x y, ¬(0 < y ∧ y ≤ x) → motive x y)\n : motive x y :=\n div.inductionOn x y ind base",
"start": [
117,
1
],
"end": [
123,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_zero",
"code": "@[simp] theorem mod_zero (a : Nat) : a % 0 = a",
"start": [
125,
1
],
"end": [
129,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_eq_of_lt",
"code": "theorem mod_eq_of_lt {a b : Nat} (h : a < b) : a % b = a",
"start": [
131,
1
],
"end": [
135,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_eq_sub_mod",
"code": "theorem mod_eq_sub_mod {a b : Nat} (h : a ≥ b) : a % b = (a - b) % b",
"start": [
137,
1
],
"end": [
140,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_lt",
"code": "theorem mod_lt (x : Nat) {y : Nat} : y > 0 → x % y < y",
"start": [
142,
1
],
"end": [
158,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_le",
"code": "theorem mod_le (x y : Nat) : x % y ≤ x",
"start": [
160,
1
],
"end": [
165,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_mod",
"code": "@[simp] theorem zero_mod (b : Nat) : 0 % b = 0",
"start": [
167,
1
],
"end": [
172,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_self",
"code": "@[simp] theorem mod_self (n : Nat) : n % n = 0",
"start": [
174,
1
],
"end": [
175,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_one",
"code": "theorem mod_one (x : Nat) : x % 1 = 0",
"start": [
177,
1
],
"end": [
184,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_add_mod",
"code": "theorem div_add_mod (m n : Nat) : n * (m / n) + m % n = m",
"start": [
186,
1
],
"end": [
195,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_sub_div",
"code": "theorem div_eq_sub_div (h₁ : 0 < b) (h₂ : b ≤ a) : a / b = (a - b) / b + 1",
"start": [
197,
1
],
"end": [
198,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_add_div",
"code": "theorem mod_add_div (m k : Nat) : m % k + k * (m / k) = m",
"start": [
201,
1
],
"end": [
204,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_one",
"code": "@[simp] protected theorem div_one (n : Nat) : n / 1 = n",
"start": [
206,
1
],
"end": [
208,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_zero",
"code": "@[simp] protected theorem div_zero (n : Nat) : n / 0 = 0",
"start": [
210,
1
],
"end": [
211,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_div",
"code": "@[simp] protected theorem zero_div (b : Nat) : 0 / b = 0",
"start": [
213,
1
],
"end": [
214,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_div_iff_mul_le",
"code": "theorem le_div_iff_mul_le (k0 : 0 < k) : x ≤ y / k ↔ x * k ≤ y",
"start": [
216,
1
],
"end": [
225,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_div_eq_div_mul",
"code": "protected theorem div_div_eq_div_mul (m n k : Nat) : m / n / k = m / (n * k)",
"start": [
227,
1
],
"end": [
245,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_mul_le_self",
"code": "theorem div_mul_le_self : ∀ (m n : Nat), m / n * n ≤ m",
"start": [
247,
1
],
"end": [
249,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_lt_iff_lt_mul",
"code": "theorem div_lt_iff_lt_mul (Hk : 0 < k) : x / k < y ↔ x < y * k",
"start": [
251,
1
],
"end": [
252,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_div_right",
"code": "@[simp] theorem add_div_right (x : Nat) {z : Nat} (H : 0 < z) : (x + z) / z = (x / z) + 1",
"start": [
254,
1
],
"end": [
255,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_div_left",
"code": "@[simp] theorem add_div_left (x : Nat) {z : Nat} (H : 0 < z) : (z + x) / z = (x / z) + 1",
"start": [
257,
1
],
"end": [
258,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mul_div_left",
"code": "theorem add_mul_div_left (x z : Nat) {y : Nat} (H : 0 < y) : (x + y * z) / y = x / y + z",
"start": [
260,
1
],
"end": [
263,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mul_div_right",
"code": "theorem add_mul_div_right (x y : Nat) {z : Nat} (H : 0 < z) : (x + y * z) / z = x / z + y",
"start": [
265,
1
],
"end": [
266,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mod_right",
"code": "@[simp] theorem add_mod_right (x z : Nat) : (x + z) % z = x % z",
"start": [
268,
1
],
"end": [
269,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mod_left",
"code": "@[simp] theorem add_mod_left (x z : Nat) : (x + z) % x = z % x",
"start": [
271,
1
],
"end": [
272,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mul_mod_self_left",
"code": "@[simp] theorem add_mul_mod_self_left (x y z : Nat) : (x + y * z) % y = x % y",
"start": [
274,
1
],
"end": [
277,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mul_mod_self_right",
"code": "@[simp] theorem add_mul_mod_self_right (x y z : Nat) : (x + y * z) % z = x % z",
"start": [
279,
1
],
"end": [
280,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mod_right",
"code": "@[simp] theorem mul_mod_right (m n : Nat) : (m * n) % m = 0",
"start": [
282,
1
],
"end": [
283,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mod_left",
"code": "@[simp] theorem mul_mod_left (m n : Nat) : (m * n) % n = 0",
"start": [
285,
1
],
"end": [
286,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_of_lt_le",
"code": "protected theorem div_eq_of_lt_le (lo : k * n ≤ m) (hi : m < (k + 1) * n) : m / n = k",
"start": [
288,
1
],
"end": [
293,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_mul_div",
"code": "theorem sub_mul_div (x n p : Nat) (h₁ : n*p ≤ x) : (x - n*p) / n = x / n - p",
"start": [
295,
1
],
"end": [
308,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_sub_div",
"code": "theorem mul_sub_div (x n p : Nat) (h₁ : x < n*p) : (n * p - (x + 1)) / n = p - ((x / n) + 1)",
"start": [
310,
1
],
"end": [
325,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mod_mul_left",
"code": "theorem mul_mod_mul_left (z x y : Nat) : (z * x) % (z * y) = z * (x % y)",
"start": [
327,
1
],
"end": [
342,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_of_lt",
"code": "theorem div_eq_of_lt (h₀ : a < b) : a / b = 0",
"start": [
344,
1
],
"end": [
347,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_cancel",
"code": "protected theorem mul_div_cancel (m : Nat) {n : Nat} (H : 0 < n) : m * n / n = m",
"start": [
349,
1
],
"end": [
351,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_cancel_left",
"code": "protected theorem mul_div_cancel_left (m : Nat) {n : Nat} (H : 0 < n) : n * m / n = m",
"start": [
353,
1
],
"end": [
354,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_le_of_le_mul",
"code": "protected theorem div_le_of_le_mul {m n : Nat} : ∀ {k}, m ≤ k * n → m / k ≤ n",
"start": [
356,
1
],
"end": [
365,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_right",
"code": "@[simp] theorem mul_div_right (n : Nat) {m : Nat} (H : 0 < m) : m * n / m = n",
"start": [
367,
1
],
"end": [
368,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_left",
"code": "@[simp] theorem mul_div_left (m : Nat) {n : Nat} (H : 0 < n) : m * n / n = m",
"start": [
370,
1
],
"end": [
371,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_self",
"code": "protected theorem div_self (H : 0 < n) : n / n = 1",
"start": [
373,
1
],
"end": [
375,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_of_eq_mul_left",
"code": "protected theorem div_eq_of_eq_mul_left (H1 : 0 < n) (H2 : m = k * n) : m / n = k",
"start": [
377,
1
],
"end": [
378,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_of_eq_mul_right",
"code": "protected theorem div_eq_of_eq_mul_right (H1 : 0 < n) (H2 : m = n * k) : m / n = k",
"start": [
380,
1
],
"end": [
381,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_mul_left",
"code": "protected theorem mul_div_mul_left {m : Nat} (n k : Nat) (H : 0 < m) :\n m * n / (m * k) = n / k",
"start": [
383,
1
],
"end": [
384,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_mul_right",
"code": "protected theorem mul_div_mul_right {m : Nat} (n k : Nat) (H : 0 < m) :\n n * m / (k * m) = n / k",
"start": [
386,
1
],
"end": [
387,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_le",
"code": "theorem mul_div_le (m n : Nat) : n * (m / n) ≤ m",
"start": [
389,
1
],
"end": [
392,
85
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Bitwise/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean",
".lake/packages/lean4/src/lean/Init/Coe.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean"
] | [
{
"full_name": "Nat.bitwise_rec_lemma",
"code": "theorem bitwise_rec_lemma {n : Nat} (hNe : n ≠ 0) : n / 2 < n",
"start": [
13,
1
],
"end": [
14,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.bitwise",
"code": "def bitwise (f : Bool → Bool → Bool) (n m : Nat) : Nat :=\n if n = 0 then\n if f false true then m else 0\n else if m = 0 then\n if f true false then n else 0\n else\n let n' := n / 2\n let m' := m / 2\n let b₁ := n % 2 = 1\n let b₂ := m % 2 = 1\n let r := bitwise f n' m'\n if f b₁ b₂ then\n r+r+1\n else\n r+r\ndecreasing_by apply bitwise_rec_lemma; assumption",
"start": [
16,
1
],
"end": [
31,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.land",
"code": "@[extern \"lean_nat_land\"]\ndef land : @& Nat → @& Nat → Nat := bitwise and",
"start": [
33,
1
],
"end": [
34,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lor",
"code": "@[extern \"lean_nat_lor\"]\ndef lor : @& Nat → @& Nat → Nat := bitwise or",
"start": [
35,
1
],
"end": [
36,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.xor",
"code": "@[extern \"lean_nat_lxor\"]\ndef xor : @& Nat → @& Nat → Nat := bitwise bne",
"start": [
37,
1
],
"end": [
38,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft",
"code": "@[extern \"lean_nat_shiftl\"]\ndef shiftLeft : @& Nat → @& Nat → Nat\n | n, 0 => n\n | n, succ m => shiftLeft (2*n) m",
"start": [
39,
1
],
"end": [
42,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight",
"code": "@[extern \"lean_nat_shiftr\"]\ndef shiftRight : @& Nat → @& Nat → Nat\n | n, 0 => n\n | n, succ m => shiftRight n m / 2",
"start": [
43,
1
],
"end": [
46,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_eq",
"code": "theorem shiftLeft_eq (a b : Nat) : a <<< b = a * 2 ^ b",
"start": [
54,
1
],
"end": [
58,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight_zero",
"code": "@[simp] theorem shiftRight_zero : n >>> 0 = n",
"start": [
60,
1
],
"end": [
60,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight_succ",
"code": "theorem shiftRight_succ (m n) : m >>> (n + 1) = (m >>> n) / 2",
"start": [
62,
1
],
"end": [
62,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight_add",
"code": "theorem shiftRight_add (m n : Nat) : ∀ k, m >>> (n + k) = (m >>> n) >>> k",
"start": [
64,
1
],
"end": [
66,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight_eq_div_pow",
"code": "theorem shiftRight_eq_div_pow (m : Nat) : ∀ n, m >>> n = m / 2 ^ n",
"start": [
68,
1
],
"end": [
72,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.testBit",
"code": "def testBit (m n : Nat) : Bool :=\n 1 &&& (m >>> n) != 0",
"start": [
80,
1
],
"end": [
83,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Fin/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Bitwise/Basic.lean"
] | [
{
"full_name": "Fin.coeToNat",
"code": "instance coeToNat : CoeOut (Fin n) Nat :=\n ⟨fun v => v.val⟩",
"start": [
13,
1
],
"end": [
14,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.elim0",
"code": "def elim0.{u} {α : Sort u} : Fin 0 → α\n | ⟨_, h⟩ => absurd h (not_lt_zero _)",
"start": [
16,
1
],
"end": [
20,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ",
"code": "def succ : Fin n → Fin n.succ\n | ⟨i, h⟩ => ⟨i+1, Nat.succ_lt_succ h⟩",
"start": [
22,
1
],
"end": [
35,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ofNat",
"code": "protected def ofNat {n : Nat} (a : Nat) : Fin n.succ :=\n ⟨a % (n+1), Nat.mod_lt _ (Nat.zero_lt_succ _)⟩",
"start": [
39,
1
],
"end": [
43,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ofNat'",
"code": "protected def ofNat' {n : Nat} (a : Nat) (h : n > 0) : Fin n :=\n ⟨a % n, Nat.mod_lt _ h⟩",
"start": [
45,
1
],
"end": [
51,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mlt",
"code": "private theorem mlt {b : Nat} : {a : Nat} → a < n → b % n < n",
"start": [
53,
1
],
"end": [
57,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add",
"code": "protected def add : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(a + b) % n, mlt h⟩",
"start": [
59,
1
],
"end": [
61,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul",
"code": "protected def mul : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(a * b) % n, mlt h⟩",
"start": [
63,
1
],
"end": [
65,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.sub",
"code": "protected def sub : Fin n → Fin n → Fin n\n \n | ⟨a, h⟩, ⟨b, _⟩ => ⟨((n - b) + a) % n, mlt h⟩",
"start": [
67,
1
],
"end": [
86,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mod",
"code": "protected def mod : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨a % b, Nat.lt_of_le_of_lt (Nat.mod_le _ _) h⟩",
"start": [
94,
1
],
"end": [
95,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.div",
"code": "protected def div : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨a / b, Nat.lt_of_le_of_lt (Nat.div_le_self _ _) h⟩",
"start": [
97,
1
],
"end": [
98,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.modn",
"code": "def modn : Fin n → Nat → Fin n\n | ⟨a, h⟩, m => ⟨a % m, Nat.lt_of_le_of_lt (Nat.mod_le _ _) h⟩",
"start": [
100,
1
],
"end": [
101,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.land",
"code": "def land : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(Nat.land a b) % n, mlt h⟩",
"start": [
103,
1
],
"end": [
104,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lor",
"code": "def lor : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(Nat.lor a b) % n, mlt h⟩",
"start": [
106,
1
],
"end": [
107,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.xor",
"code": "def xor : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(Nat.xor a b) % n, mlt h⟩",
"start": [
109,
1
],
"end": [
110,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.shiftLeft",
"code": "def shiftLeft : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(a <<< b) % n, mlt h⟩",
"start": [
112,
1
],
"end": [
113,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.shiftRight",
"code": "def shiftRight : Fin n → Fin n → Fin n\n | ⟨a, h⟩, ⟨b, _⟩ => ⟨(a >>> b) % n, mlt h⟩",
"start": [
115,
1
],
"end": [
116,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.instOfNat",
"code": "instance instOfNat : OfNat (Fin (no_index (n+1))) i where\n ofNat := Fin.ofNat i",
"start": [
144,
1
],
"end": [
145,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.zero_eta",
"code": "@[simp] theorem zero_eta : (⟨0, Nat.zero_lt_succ _⟩ : Fin (n + 1)) = 0",
"start": [
150,
1
],
"end": [
150,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_ne_of_ne",
"code": "theorem val_ne_of_ne {i j : Fin n} (h : i ≠ j) : val i ≠ val j",
"start": [
152,
1
],
"end": [
153,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.modn_lt",
"code": "theorem modn_lt : ∀ {m : Nat} (i : Fin n), m > 0 → (modn i m).val < m",
"start": [
155,
1
],
"end": [
156,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_lt_of_le",
"code": "theorem val_lt_of_le (i : Fin b) (h : b ≤ n) : i.val < n",
"start": [
158,
1
],
"end": [
159,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pos",
"code": "protected theorem pos (i : Fin n) : 0 < n",
"start": [
161,
1
],
"end": [
162,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.last",
"code": "@[inline] def last (n : Nat) : Fin (n + 1) := ⟨n, n.lt_succ_self⟩",
"start": [
164,
1
],
"end": [
165,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLT",
"code": "@[inline] def castLT (i : Fin m) (h : i.1 < n) : Fin n := ⟨i.1, h⟩",
"start": [
167,
1
],
"end": [
168,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE",
"code": "@[inline] def castLE (h : n ≤ m) (i : Fin n) : Fin m := ⟨i, Nat.lt_of_lt_of_le i.2 h⟩",
"start": [
170,
1
],
"end": [
171,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast",
"code": "@[inline] def cast (eq : n = m) (i : Fin n) : Fin m := ⟨i, eq ▸ i.2⟩",
"start": [
173,
1
],
"end": [
174,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd",
"code": "@[inline] def castAdd (m) : Fin n → Fin (n + m) :=\n castLE <| Nat.le_add_right n m",
"start": [
176,
1
],
"end": [
178,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc",
"code": "@[inline] def castSucc : Fin n → Fin (n + 1) := castAdd 1",
"start": [
180,
1
],
"end": [
181,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addNat",
"code": "def addNat (i : Fin n) (m) : Fin (n + m) := ⟨i + m, Nat.add_lt_add_right i.2 _⟩",
"start": [
183,
1
],
"end": [
184,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd",
"code": "def natAdd (n) (i : Fin m) : Fin (n + m) := ⟨n + i, Nat.add_lt_add_left i.2 _⟩",
"start": [
186,
1
],
"end": [
187,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev",
"code": "@[inline] def rev (i : Fin n) : Fin n := ⟨n - (i + 1), Nat.sub_lt i.pos (Nat.succ_pos _)⟩",
"start": [
189,
1
],
"end": [
190,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subNat",
"code": "@[inline] def subNat (m) (i : Fin (n + m)) (h : m ≤ i) : Fin n :=\n ⟨i - m, Nat.sub_lt_right_of_lt_add h i.2⟩",
"start": [
192,
1
],
"end": [
194,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred",
"code": "@[inline] def pred {n : Nat} (i : Fin (n + 1)) (h : i ≠ 0) : Fin n :=\n subNat 1 i <| Nat.pos_of_ne_zero <| mt (Fin.eq_of_val_eq (j := 0)) h",
"start": [
196,
1
],
"end": [
198,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_inj",
"code": "theorem val_inj {a b : Fin n} : a.1 = b.1 ↔ a = b",
"start": [
200,
1
],
"end": [
200,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_congr",
"code": "theorem val_congr {n : Nat} {a b : Fin n} (h : a = b) : (a : Nat) = (b : Nat)",
"start": [
202,
1
],
"end": [
203,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_le_of_le",
"code": "theorem val_le_of_le {n : Nat} {a b : Fin n} (h : a ≤ b) : (a : Nat) ≤ (b : Nat)",
"start": [
205,
1
],
"end": [
205,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_le_of_ge",
"code": "theorem val_le_of_ge {n : Nat} {a b : Fin n} (h : a ≥ b) : (b : Nat) ≤ (a : Nat)",
"start": [
207,
1
],
"end": [
207,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_add_one_le_of_lt",
"code": "theorem val_add_one_le_of_lt {n : Nat} {a b : Fin n} (h : a < b) : (a : Nat) + 1 ≤ (b : Nat)",
"start": [
209,
1
],
"end": [
209,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_add_one_le_of_gt",
"code": "theorem val_add_one_le_of_gt {n : Nat} {a b : Fin n} (h : a > b) : (b : Nat) + 1 ≤ (a : Nat)",
"start": [
211,
1
],
"end": [
211,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.exists_iff",
"code": "theorem exists_iff {p : Fin n → Prop} : (Exists fun i => p i) ↔ Exists fun i => Exists fun h => p ⟨i, h⟩",
"start": [
213,
1
],
"end": [
214,
75
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/List/Notation.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Control/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "Functor.mapRev",
"code": "@[reducible]\ndef Functor.mapRev {f : Type u → Type v} [Functor f] {α β : Type u} : f α → (α → β) → f β :=\n fun a f => f <$> a",
"start": [
11,
1
],
"end": [
13,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Functor.discard",
"code": "@[always_inline, inline]\ndef Functor.discard {f : Type u → Type v} {α : Type u} [Functor f] (x : f α) : f PUnit :=\n Functor.mapConst PUnit.unit x",
"start": [
17,
1
],
"end": [
19,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Alternative",
"code": "class Alternative (f : Type u → Type v) extends Applicative f : Type (max (u+1) v) where\n \n failure : {α : Type u} → f α\n \n orElse : {α : Type u} → f α → (Unit → f α) → f α",
"start": [
23,
1
],
"end": [
46,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "guard",
"code": "@[always_inline, inline] def guard {f : Type → Type v} [Alternative f] (p : Prop) [Decidable p] : f Unit :=\n if p then pure () else failure",
"start": [
54,
1
],
"end": [
58,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "optional",
"code": "@[always_inline, inline] def optional (x : f α) : f (Option α) :=\n some <$> x <|> pure none",
"start": [
60,
1
],
"end": [
64,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "ToBool",
"code": "class ToBool (α : Type u) where\n toBool : α → Bool",
"start": [
66,
1
],
"end": [
67,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "bool",
"code": "@[macro_inline] def bool {β : Type u} {α : Type v} [ToBool β] (f t : α) (b : β) : α :=\n match toBool b with\n | true => t\n | false => f",
"start": [
74,
1
],
"end": [
77,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "orM",
"code": "@[macro_inline] def orM {m : Type u → Type v} {β : Type u} [Monad m] [ToBool β] (x y : m β) : m β := do\n let b ← x\n match toBool b with\n | true => pure b\n | false => y",
"start": [
79,
1
],
"end": [
83,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "andM",
"code": "@[macro_inline] def andM {m : Type u → Type v} {β : Type u} [Monad m] [ToBool β] (x y : m β) : m β := do\n let b ← x\n match toBool b with\n | true => y\n | false => pure b",
"start": [
87,
1
],
"end": [
91,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "notM",
"code": "@[macro_inline] def notM {m : Type → Type v} [Applicative m] (x : m Bool) : m Bool :=\n not <$> x",
"start": [
95,
1
],
"end": [
96,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadControl",
"code": "class MonadControl (m : semiOutParam (Type u → Type v)) (n : Type u → Type w) where\n stM : Type u → Type u\n liftWith : {α : Type u} → (({β : Type u} → n β → m (stM β)) → m α) → n α\n restoreM : {α : Type u} → m (stM α) → n α",
"start": [
210,
1
],
"end": [
219,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadControlT",
"code": "class MonadControlT (m : Type u → Type v) (n : Type u → Type w) where\n stM : Type u → Type u\n liftWith : {α : Type u} → (({β : Type u} → n β → m (stM β)) → m α) → n α\n restoreM {α : Type u} : stM α → n α",
"start": [
221,
1
],
"end": [
225,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "controlAt",
"code": "@[always_inline, inline]\ndef controlAt (m : Type u → Type v) {n : Type u → Type w} [MonadControlT m n] [Bind n] {α : Type u}\n (f : ({β : Type u} → n β → m (stM m n β)) → m (stM m n α)) : n α :=\n liftWith f >>= restoreM",
"start": [
240,
1
],
"end": [
243,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "control",
"code": "@[always_inline, inline]\ndef control {m : Type u → Type v} {n : Type u → Type w} [MonadControlT m n] [Bind n] {α : Type u}\n (f : ({β : Type u} → n β → m (stM m n β)) → m (stM m n α)) : n α :=\n controlAt m f",
"start": [
245,
1
],
"end": [
248,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "ForM",
"code": "class ForM (m : Type u → Type v) (γ : Type w₁) (α : outParam (Type w₂)) where\n forM [Monad m] : γ → (α → m PUnit) → m PUnit",
"start": [
250,
1
],
"end": [
258,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Bind.kleisliRight",
"code": "@[always_inline]\ndef Bind.kleisliRight [Bind m] (f₁ : α → m β) (f₂ : β → m γ) (a : α) : m γ :=\n f₁ a >>= f₂",
"start": [
262,
1
],
"end": [
265,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Bind.kleisliLeft",
"code": "@[always_inline]\ndef Bind.kleisliLeft [Bind m] (f₂ : β → m γ) (f₁ : α → m β) (a : α) : m γ :=\n f₁ a >>= f₂",
"start": [
267,
1
],
"end": [
270,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Bind.bindLeft",
"code": "@[always_inline]\ndef Bind.bindLeft [Bind m] (f : α → m β) (ma : m α) : m β :=\n ma >>= f",
"start": [
272,
1
],
"end": [
275,
11
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Fin/Basic.lean"
] | [
{
"full_name": "UInt8.ofNat",
"code": "@[extern \"lean_uint8_of_nat\"]\ndef UInt8.ofNat (n : @& Nat) : UInt8 := ⟨Fin.ofNat n⟩",
"start": [
11,
1
],
"end": [
12,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toUInt8",
"code": "abbrev Nat.toUInt8 := UInt8.ofNat",
"start": [
13,
1
],
"end": [
13,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.toNat",
"code": "@[extern \"lean_uint8_to_nat\"]\ndef UInt8.toNat (n : UInt8) : Nat := n.val.val",
"start": [
14,
1
],
"end": [
15,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.add",
"code": "@[extern \"lean_uint8_add\"]\ndef UInt8.add (a b : UInt8) : UInt8 := ⟨a.val + b.val⟩",
"start": [
16,
1
],
"end": [
17,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.sub",
"code": "@[extern \"lean_uint8_sub\"]\ndef UInt8.sub (a b : UInt8) : UInt8 := ⟨a.val - b.val⟩",
"start": [
18,
1
],
"end": [
19,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.mul",
"code": "@[extern \"lean_uint8_mul\"]\ndef UInt8.mul (a b : UInt8) : UInt8 := ⟨a.val * b.val⟩",
"start": [
20,
1
],
"end": [
21,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.div",
"code": "@[extern \"lean_uint8_div\"]\ndef UInt8.div (a b : UInt8) : UInt8 := ⟨a.val / b.val⟩",
"start": [
22,
1
],
"end": [
23,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.mod",
"code": "@[extern \"lean_uint8_mod\"]\ndef UInt8.mod (a b : UInt8) : UInt8 := ⟨a.val % b.val⟩",
"start": [
24,
1
],
"end": [
25,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.modn",
"code": "@[extern \"lean_uint8_modn\"]\ndef UInt8.modn (a : UInt8) (n : @& Nat) : UInt8 := ⟨Fin.modn a.val n⟩",
"start": [
26,
1
],
"end": [
27,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.land",
"code": "@[extern \"lean_uint8_land\"]\ndef UInt8.land (a b : UInt8) : UInt8 := ⟨Fin.land a.val b.val⟩",
"start": [
28,
1
],
"end": [
29,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.lor",
"code": "@[extern \"lean_uint8_lor\"]\ndef UInt8.lor (a b : UInt8) : UInt8 := ⟨Fin.lor a.val b.val⟩",
"start": [
30,
1
],
"end": [
31,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.xor",
"code": "@[extern \"lean_uint8_xor\"]\ndef UInt8.xor (a b : UInt8) : UInt8 := ⟨Fin.xor a.val b.val⟩",
"start": [
32,
1
],
"end": [
33,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.shiftLeft",
"code": "@[extern \"lean_uint8_shift_left\"]\ndef UInt8.shiftLeft (a b : UInt8) : UInt8 := ⟨a.val <<< (modn b 8).val⟩",
"start": [
34,
1
],
"end": [
35,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.shiftRight",
"code": "@[extern \"lean_uint8_shift_right\"]\ndef UInt8.shiftRight (a b : UInt8) : UInt8 := ⟨a.val >>> (modn b 8).val⟩",
"start": [
36,
1
],
"end": [
37,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.lt",
"code": "def UInt8.lt (a b : UInt8) : Prop := a.val < b.val",
"start": [
38,
1
],
"end": [
38,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.le",
"code": "def UInt8.le (a b : UInt8) : Prop := a.val ≤ b.val",
"start": [
39,
1
],
"end": [
39,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.instOfNat",
"code": "instance UInt8.instOfNat : OfNat UInt8 n := ⟨UInt8.ofNat n⟩",
"start": [
41,
1
],
"end": [
41,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.complement",
"code": "@[extern \"lean_uint8_complement\"]\ndef UInt8.complement (a:UInt8) : UInt8 := 0-(a+1)",
"start": [
51,
1
],
"end": [
52,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.decLt",
"code": "@[extern \"lean_uint8_dec_lt\"]\ndef UInt8.decLt (a b : UInt8) : Decidable (a < b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n < m))",
"start": [
62,
1
],
"end": [
65,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.decLe",
"code": "@[extern \"lean_uint8_dec_le\"]\ndef UInt8.decLe (a b : UInt8) : Decidable (a ≤ b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n <= m))",
"start": [
68,
1
],
"end": [
71,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.ofNat",
"code": "@[extern \"lean_uint16_of_nat\"]\ndef UInt16.ofNat (n : @& Nat) : UInt16 := ⟨Fin.ofNat n⟩",
"start": [
78,
1
],
"end": [
79,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toUInt16",
"code": "abbrev Nat.toUInt16 := UInt16.ofNat",
"start": [
80,
1
],
"end": [
80,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.toNat",
"code": "@[extern \"lean_uint16_to_nat\"]\ndef UInt16.toNat (n : UInt16) : Nat := n.val.val",
"start": [
81,
1
],
"end": [
82,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.add",
"code": "@[extern \"lean_uint16_add\"]\ndef UInt16.add (a b : UInt16) : UInt16 := ⟨a.val + b.val⟩",
"start": [
83,
1
],
"end": [
84,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.sub",
"code": "@[extern \"lean_uint16_sub\"]\ndef UInt16.sub (a b : UInt16) : UInt16 := ⟨a.val - b.val⟩",
"start": [
85,
1
],
"end": [
86,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.mul",
"code": "@[extern \"lean_uint16_mul\"]\ndef UInt16.mul (a b : UInt16) : UInt16 := ⟨a.val * b.val⟩",
"start": [
87,
1
],
"end": [
88,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.div",
"code": "@[extern \"lean_uint16_div\"]\ndef UInt16.div (a b : UInt16) : UInt16 := ⟨a.val / b.val⟩",
"start": [
89,
1
],
"end": [
90,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.mod",
"code": "@[extern \"lean_uint16_mod\"]\ndef UInt16.mod (a b : UInt16) : UInt16 := ⟨a.val % b.val⟩",
"start": [
91,
1
],
"end": [
92,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.modn",
"code": "@[extern \"lean_uint16_modn\"]\ndef UInt16.modn (a : UInt16) (n : @& Nat) : UInt16 := ⟨Fin.modn a.val n⟩",
"start": [
93,
1
],
"end": [
94,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.land",
"code": "@[extern \"lean_uint16_land\"]\ndef UInt16.land (a b : UInt16) : UInt16 := ⟨Fin.land a.val b.val⟩",
"start": [
95,
1
],
"end": [
96,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.lor",
"code": "@[extern \"lean_uint16_lor\"]\ndef UInt16.lor (a b : UInt16) : UInt16 := ⟨Fin.lor a.val b.val⟩",
"start": [
97,
1
],
"end": [
98,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.xor",
"code": "@[extern \"lean_uint16_xor\"]\ndef UInt16.xor (a b : UInt16) : UInt16 := ⟨Fin.xor a.val b.val⟩",
"start": [
99,
1
],
"end": [
100,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.shiftLeft",
"code": "@[extern \"lean_uint16_shift_left\"]\ndef UInt16.shiftLeft (a b : UInt16) : UInt16 := ⟨a.val <<< (modn b 16).val⟩",
"start": [
101,
1
],
"end": [
102,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.toUInt8",
"code": "@[extern \"lean_uint16_to_uint8\"]\ndef UInt16.toUInt8 (a : UInt16) : UInt8 := a.toNat.toUInt8",
"start": [
103,
1
],
"end": [
104,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.toUInt16",
"code": "@[extern \"lean_uint8_to_uint16\"]\ndef UInt8.toUInt16 (a : UInt8) : UInt16 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
105,
1
],
"end": [
106,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.shiftRight",
"code": "@[extern \"lean_uint16_shift_right\"]\ndef UInt16.shiftRight (a b : UInt16) : UInt16 := ⟨a.val >>> (modn b 16).val⟩",
"start": [
107,
1
],
"end": [
108,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.lt",
"code": "def UInt16.lt (a b : UInt16) : Prop := a.val < b.val",
"start": [
109,
1
],
"end": [
109,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.le",
"code": "def UInt16.le (a b : UInt16) : Prop := a.val ≤ b.val",
"start": [
110,
1
],
"end": [
110,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.instOfNat",
"code": "instance UInt16.instOfNat : OfNat UInt16 n := ⟨UInt16.ofNat n⟩",
"start": [
112,
1
],
"end": [
112,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.complement",
"code": "@[extern \"lean_uint16_complement\"]\ndef UInt16.complement (a:UInt16) : UInt16 := 0-(a+1)",
"start": [
122,
1
],
"end": [
123,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.decLt",
"code": "@[extern \"lean_uint16_dec_lt\"]\ndef UInt16.decLt (a b : UInt16) : Decidable (a < b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n < m))",
"start": [
133,
1
],
"end": [
136,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.decLe",
"code": "@[extern \"lean_uint16_dec_le\"]\ndef UInt16.decLe (a b : UInt16) : Decidable (a ≤ b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n <= m))",
"start": [
139,
1
],
"end": [
142,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.ofNat",
"code": "@[extern \"lean_uint32_of_nat\"]\ndef UInt32.ofNat (n : @& Nat) : UInt32 := ⟨Fin.ofNat n⟩",
"start": [
149,
1
],
"end": [
150,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.ofNat'",
"code": "@[extern \"lean_uint32_of_nat\"]\ndef UInt32.ofNat' (n : Nat) (h : n < UInt32.size) : UInt32 := ⟨⟨n, h⟩⟩",
"start": [
151,
1
],
"end": [
152,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.ofNatTruncate",
"code": "def UInt32.ofNatTruncate (n : Nat) : UInt32 :=\n if h : n < UInt32.size then\n UInt32.ofNat' n h\n else\n UInt32.ofNat' (UInt32.size - 1) (by decide)",
"start": [
153,
1
],
"end": [
160,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toUInt32",
"code": "abbrev Nat.toUInt32 := UInt32.ofNat",
"start": [
161,
1
],
"end": [
161,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.add",
"code": "@[extern \"lean_uint32_add\"]\ndef UInt32.add (a b : UInt32) : UInt32 := ⟨a.val + b.val⟩",
"start": [
162,
1
],
"end": [
163,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.sub",
"code": "@[extern \"lean_uint32_sub\"]\ndef UInt32.sub (a b : UInt32) : UInt32 := ⟨a.val - b.val⟩",
"start": [
164,
1
],
"end": [
165,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.mul",
"code": "@[extern \"lean_uint32_mul\"]\ndef UInt32.mul (a b : UInt32) : UInt32 := ⟨a.val * b.val⟩",
"start": [
166,
1
],
"end": [
167,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.div",
"code": "@[extern \"lean_uint32_div\"]\ndef UInt32.div (a b : UInt32) : UInt32 := ⟨a.val / b.val⟩",
"start": [
168,
1
],
"end": [
169,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.mod",
"code": "@[extern \"lean_uint32_mod\"]\ndef UInt32.mod (a b : UInt32) : UInt32 := ⟨a.val % b.val⟩",
"start": [
170,
1
],
"end": [
171,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.modn",
"code": "@[extern \"lean_uint32_modn\"]\ndef UInt32.modn (a : UInt32) (n : @& Nat) : UInt32 := ⟨Fin.modn a.val n⟩",
"start": [
172,
1
],
"end": [
173,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.land",
"code": "@[extern \"lean_uint32_land\"]\ndef UInt32.land (a b : UInt32) : UInt32 := ⟨Fin.land a.val b.val⟩",
"start": [
174,
1
],
"end": [
175,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.lor",
"code": "@[extern \"lean_uint32_lor\"]\ndef UInt32.lor (a b : UInt32) : UInt32 := ⟨Fin.lor a.val b.val⟩",
"start": [
176,
1
],
"end": [
177,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.xor",
"code": "@[extern \"lean_uint32_xor\"]\ndef UInt32.xor (a b : UInt32) : UInt32 := ⟨Fin.xor a.val b.val⟩",
"start": [
178,
1
],
"end": [
179,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.shiftLeft",
"code": "@[extern \"lean_uint32_shift_left\"]\ndef UInt32.shiftLeft (a b : UInt32) : UInt32 := ⟨a.val <<< (modn b 32).val⟩",
"start": [
180,
1
],
"end": [
181,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.shiftRight",
"code": "@[extern \"lean_uint32_shift_right\"]\ndef UInt32.shiftRight (a b : UInt32) : UInt32 := ⟨a.val >>> (modn b 32).val⟩",
"start": [
182,
1
],
"end": [
183,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.toUInt8",
"code": "@[extern \"lean_uint32_to_uint8\"]\ndef UInt32.toUInt8 (a : UInt32) : UInt8 := a.toNat.toUInt8",
"start": [
184,
1
],
"end": [
185,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.toUInt16",
"code": "@[extern \"lean_uint32_to_uint16\"]\ndef UInt32.toUInt16 (a : UInt32) : UInt16 := a.toNat.toUInt16",
"start": [
186,
1
],
"end": [
187,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.toUInt32",
"code": "@[extern \"lean_uint8_to_uint32\"]\ndef UInt8.toUInt32 (a : UInt8) : UInt32 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
188,
1
],
"end": [
189,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.toUInt32",
"code": "@[extern \"lean_uint16_to_uint32\"]\ndef UInt16.toUInt32 (a : UInt16) : UInt32 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
190,
1
],
"end": [
191,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.instOfNat",
"code": "instance UInt32.instOfNat : OfNat UInt32 n := ⟨UInt32.ofNat n⟩",
"start": [
193,
1
],
"end": [
193,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.complement",
"code": "@[extern \"lean_uint32_complement\"]\ndef UInt32.complement (a:UInt32) : UInt32 := 0-(a+1)",
"start": [
201,
1
],
"end": [
202,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.ofNat",
"code": "@[extern \"lean_uint64_of_nat\"]\ndef UInt64.ofNat (n : @& Nat) : UInt64 := ⟨Fin.ofNat n⟩",
"start": [
211,
1
],
"end": [
212,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toUInt64",
"code": "abbrev Nat.toUInt64 := UInt64.ofNat",
"start": [
213,
1
],
"end": [
213,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.toNat",
"code": "@[extern \"lean_uint64_to_nat\"]\ndef UInt64.toNat (n : UInt64) : Nat := n.val.val",
"start": [
214,
1
],
"end": [
215,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.add",
"code": "@[extern \"lean_uint64_add\"]\ndef UInt64.add (a b : UInt64) : UInt64 := ⟨a.val + b.val⟩",
"start": [
216,
1
],
"end": [
217,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.sub",
"code": "@[extern \"lean_uint64_sub\"]\ndef UInt64.sub (a b : UInt64) : UInt64 := ⟨a.val - b.val⟩",
"start": [
218,
1
],
"end": [
219,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.mul",
"code": "@[extern \"lean_uint64_mul\"]\ndef UInt64.mul (a b : UInt64) : UInt64 := ⟨a.val * b.val⟩",
"start": [
220,
1
],
"end": [
221,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.div",
"code": "@[extern \"lean_uint64_div\"]\ndef UInt64.div (a b : UInt64) : UInt64 := ⟨a.val / b.val⟩",
"start": [
222,
1
],
"end": [
223,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.mod",
"code": "@[extern \"lean_uint64_mod\"]\ndef UInt64.mod (a b : UInt64) : UInt64 := ⟨a.val % b.val⟩",
"start": [
224,
1
],
"end": [
225,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.modn",
"code": "@[extern \"lean_uint64_modn\"]\ndef UInt64.modn (a : UInt64) (n : @& Nat) : UInt64 := ⟨Fin.modn a.val n⟩",
"start": [
226,
1
],
"end": [
227,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.land",
"code": "@[extern \"lean_uint64_land\"]\ndef UInt64.land (a b : UInt64) : UInt64 := ⟨Fin.land a.val b.val⟩",
"start": [
228,
1
],
"end": [
229,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.lor",
"code": "@[extern \"lean_uint64_lor\"]\ndef UInt64.lor (a b : UInt64) : UInt64 := ⟨Fin.lor a.val b.val⟩",
"start": [
230,
1
],
"end": [
231,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.xor",
"code": "@[extern \"lean_uint64_xor\"]\ndef UInt64.xor (a b : UInt64) : UInt64 := ⟨Fin.xor a.val b.val⟩",
"start": [
232,
1
],
"end": [
233,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.shiftLeft",
"code": "@[extern \"lean_uint64_shift_left\"]\ndef UInt64.shiftLeft (a b : UInt64) : UInt64 := ⟨a.val <<< (modn b 64).val⟩",
"start": [
234,
1
],
"end": [
235,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.shiftRight",
"code": "@[extern \"lean_uint64_shift_right\"]\ndef UInt64.shiftRight (a b : UInt64) : UInt64 := ⟨a.val >>> (modn b 64).val⟩",
"start": [
236,
1
],
"end": [
237,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.lt",
"code": "def UInt64.lt (a b : UInt64) : Prop := a.val < b.val",
"start": [
238,
1
],
"end": [
238,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.le",
"code": "def UInt64.le (a b : UInt64) : Prop := a.val ≤ b.val",
"start": [
239,
1
],
"end": [
239,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.toUInt8",
"code": "@[extern \"lean_uint64_to_uint8\"]\ndef UInt64.toUInt8 (a : UInt64) : UInt8 := a.toNat.toUInt8",
"start": [
240,
1
],
"end": [
241,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.toUInt16",
"code": "@[extern \"lean_uint64_to_uint16\"]\ndef UInt64.toUInt16 (a : UInt64) : UInt16 := a.toNat.toUInt16",
"start": [
242,
1
],
"end": [
243,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.toUInt32",
"code": "@[extern \"lean_uint64_to_uint32\"]\ndef UInt64.toUInt32 (a : UInt64) : UInt32 := a.toNat.toUInt32",
"start": [
244,
1
],
"end": [
245,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt8.toUInt64",
"code": "@[extern \"lean_uint8_to_uint64\"]\ndef UInt8.toUInt64 (a : UInt8) : UInt64 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
246,
1
],
"end": [
247,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt16.toUInt64",
"code": "@[extern \"lean_uint16_to_uint64\"]\ndef UInt16.toUInt64 (a : UInt16) : UInt64 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
248,
1
],
"end": [
249,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.toUInt64",
"code": "@[extern \"lean_uint32_to_uint64\"]\ndef UInt32.toUInt64 (a : UInt32) : UInt64 := ⟨a.val, Nat.lt_trans a.1.2 (by decide)⟩",
"start": [
250,
1
],
"end": [
251,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.instOfNat",
"code": "instance UInt64.instOfNat : OfNat UInt64 n := ⟨UInt64.ofNat n⟩",
"start": [
253,
1
],
"end": [
253,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.complement",
"code": "@[extern \"lean_uint64_complement\"]\ndef UInt64.complement (a:UInt64) : UInt64 := 0-(a+1)",
"start": [
263,
1
],
"end": [
264,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toUInt64",
"code": "@[extern \"lean_bool_to_uint64\"]\ndef Bool.toUInt64 (b : Bool) : UInt64 := if b then 1 else 0",
"start": [
273,
1
],
"end": [
274,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.decLt",
"code": "@[extern \"lean_uint64_dec_lt\"]\ndef UInt64.decLt (a b : UInt64) : Decidable (a < b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n < m))",
"start": [
277,
1
],
"end": [
280,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt64.decLe",
"code": "@[extern \"lean_uint64_dec_le\"]\ndef UInt64.decLe (a b : UInt64) : Decidable (a ≤ b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n <= m))",
"start": [
283,
1
],
"end": [
286,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "usize_size_gt_zero",
"code": "theorem usize_size_gt_zero : USize.size > 0",
"start": [
293,
1
],
"end": [
294,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.ofNat",
"code": "@[extern \"lean_usize_of_nat\"]\ndef USize.ofNat (n : @& Nat) : USize := ⟨Fin.ofNat' n usize_size_gt_zero⟩",
"start": [
296,
1
],
"end": [
297,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toUSize",
"code": "abbrev Nat.toUSize := USize.ofNat",
"start": [
298,
1
],
"end": [
298,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.toNat",
"code": "@[extern \"lean_usize_to_nat\"]\ndef USize.toNat (n : USize) : Nat := n.val.val",
"start": [
299,
1
],
"end": [
300,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.add",
"code": "@[extern \"lean_usize_add\"]\ndef USize.add (a b : USize) : USize := ⟨a.val + b.val⟩",
"start": [
301,
1
],
"end": [
302,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.sub",
"code": "@[extern \"lean_usize_sub\"]\ndef USize.sub (a b : USize) : USize := ⟨a.val - b.val⟩",
"start": [
303,
1
],
"end": [
304,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.mul",
"code": "@[extern \"lean_usize_mul\"]\ndef USize.mul (a b : USize) : USize := ⟨a.val * b.val⟩",
"start": [
305,
1
],
"end": [
306,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.div",
"code": "@[extern \"lean_usize_div\"]\ndef USize.div (a b : USize) : USize := ⟨a.val / b.val⟩",
"start": [
307,
1
],
"end": [
308,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.mod",
"code": "@[extern \"lean_usize_mod\"]\ndef USize.mod (a b : USize) : USize := ⟨a.val % b.val⟩",
"start": [
309,
1
],
"end": [
310,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.modn",
"code": "@[extern \"lean_usize_modn\"]\ndef USize.modn (a : USize) (n : @& Nat) : USize := ⟨Fin.modn a.val n⟩",
"start": [
311,
1
],
"end": [
312,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.land",
"code": "@[extern \"lean_usize_land\"]\ndef USize.land (a b : USize) : USize := ⟨Fin.land a.val b.val⟩",
"start": [
313,
1
],
"end": [
314,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.lor",
"code": "@[extern \"lean_usize_lor\"]\ndef USize.lor (a b : USize) : USize := ⟨Fin.lor a.val b.val⟩",
"start": [
315,
1
],
"end": [
316,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.xor",
"code": "@[extern \"lean_usize_xor\"]\ndef USize.xor (a b : USize) : USize := ⟨Fin.xor a.val b.val⟩",
"start": [
317,
1
],
"end": [
318,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.shiftLeft",
"code": "@[extern \"lean_usize_shift_left\"]\ndef USize.shiftLeft (a b : USize) : USize := ⟨a.val <<< (modn b System.Platform.numBits).val⟩",
"start": [
319,
1
],
"end": [
320,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.shiftRight",
"code": "@[extern \"lean_usize_shift_right\"]\ndef USize.shiftRight (a b : USize) : USize := ⟨a.val >>> (modn b System.Platform.numBits).val⟩",
"start": [
321,
1
],
"end": [
322,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "UInt32.toUSize",
"code": "@[extern \"lean_uint32_to_usize\"]\ndef UInt32.toUSize (a : UInt32) : USize := USize.ofNat32 a.val a.1.2",
"start": [
323,
1
],
"end": [
324,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.toUInt32",
"code": "@[extern \"lean_usize_to_uint32\"]\ndef USize.toUInt32 (a : USize) : UInt32 := a.toNat.toUInt32",
"start": [
325,
1
],
"end": [
326,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.lt",
"code": "def USize.lt (a b : USize) : Prop := a.val < b.val",
"start": [
328,
1
],
"end": [
328,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.le",
"code": "def USize.le (a b : USize) : Prop := a.val ≤ b.val",
"start": [
329,
1
],
"end": [
329,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.instOfNat",
"code": "instance USize.instOfNat : OfNat USize n := ⟨USize.ofNat n⟩",
"start": [
331,
1
],
"end": [
331,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.complement",
"code": "@[extern \"lean_usize_complement\"]\ndef USize.complement (a:USize) : USize := 0-(a+1)",
"start": [
341,
1
],
"end": [
342,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.decLt",
"code": "@[extern \"lean_usize_dec_lt\"]\ndef USize.decLt (a b : USize) : Decidable (a < b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n < m))",
"start": [
352,
1
],
"end": [
355,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.decLe",
"code": "@[extern \"lean_usize_dec_le\"]\ndef USize.decLe (a b : USize) : Decidable (a ≤ b) :=\n match a, b with\n | ⟨n⟩, ⟨m⟩ => inferInstanceAs (Decidable (n <= m))",
"start": [
358,
1
],
"end": [
361,
53
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/Id.lean | [
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "Id",
"code": "def Id (type : Type u) : Type u := type",
"start": [
13,
1
],
"end": [
13,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.hasBind",
"code": "def hasBind : Bind Id :=\n inferInstance",
"start": [
23,
1
],
"end": [
24,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.run",
"code": "@[always_inline, inline]\nprotected def run (x : Id α) : α := x",
"start": [
26,
1
],
"end": [
27,
38
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Cast.lean | [
".lake/packages/lean4/src/lean/Init/Coe.lean"
] | [
{
"full_name": "NatCast",
"code": "class NatCast (R : Type u) where\n \n protected natCast : Nat → R",
"start": [
47,
1
],
"end": [
50,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.cast",
"code": "@[coe, reducible, match_pattern] protected def Nat.cast {R : Type u} [NatCast R] : Nat → R :=\n NatCast.natCast",
"start": [
54,
1
],
"end": [
66,
18
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/List/Basic.lean | [
".lake/packages/lean4/src/lean/Init/SimpLemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/List/Notation.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean"
] | [
{
"full_name": "List.length_nil",
"code": "@[simp] theorem length_nil : length ([] : List α) = 0",
"start": [
65,
1
],
"end": [
66,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_singleton",
"code": "@[simp 1100] theorem length_singleton (a : α) : length [a] = 1",
"start": [
68,
1
],
"end": [
68,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_cons",
"code": "@[simp] theorem length_cons {α} (a : α) (as : List α) : (cons a as).length = as.length + 1",
"start": [
70,
1
],
"end": [
71,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_set",
"code": "@[simp] theorem length_set (as : List α) (i : Nat) (a : α) : (as.set i a).length = as.length",
"start": [
75,
1
],
"end": [
81,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_nil",
"code": "@[simp] theorem foldl_nil : [].foldl f b = b",
"start": [
86,
1
],
"end": [
86,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_cons",
"code": "@[simp] theorem foldl_cons (l : List α) (b : β) : (a :: l).foldl f b = l.foldl f (f b a)",
"start": [
87,
1
],
"end": [
87,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_concat",
"code": "@[simp] theorem length_concat (as : List α) (a : α) : (concat as a).length = as.length + 1",
"start": [
91,
1
],
"end": [
94,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "List.of_concat_eq_concat",
"code": "theorem of_concat_eq_concat {as bs : List α} {a b : α} (h : as.concat a = bs.concat b) : as = bs ∧ a = b",
"start": [
96,
1
],
"end": [
103,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.beq",
"code": "protected def beq [BEq α] : List α → List α → Bool\n | [], [] => true\n | a::as, b::bs => a == b && List.beq as bs\n | _, _ => false",
"start": [
107,
1
],
"end": [
114,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEqv",
"code": "@[specialize] def isEqv : (as bs : List α) → (eqv : α → α → Bool) → Bool\n | [], [], _ => true\n | a::as, b::bs, eqv => eqv a b && isEqv as bs eqv\n | _, _, _ => false",
"start": [
134,
1
],
"end": [
141,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEqv_nil_nil",
"code": "@[simp] theorem isEqv_nil_nil : isEqv ([] : List α) [] eqv = true",
"start": [
143,
1
],
"end": [
143,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEqv_nil_cons",
"code": "@[simp] theorem isEqv_nil_cons : isEqv ([] : List α) (a::as) eqv = false",
"start": [
144,
1
],
"end": [
144,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEqv_cons_nil",
"code": "@[simp] theorem isEqv_cons_nil : isEqv (a::as : List α) [] eqv = false",
"start": [
145,
1
],
"end": [
145,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEqv_cons₂",
"code": "theorem isEqv_cons₂ : isEqv (a::as) (b::bs) eqv = (eqv a b && isEqv as bs eqv)",
"start": [
146,
1
],
"end": [
146,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lt",
"code": "inductive lt [LT α] : List α → List α → Prop where\n \n | nil (b : α) (bs : List α) : lt [] (b::bs)\n \n | head {a : α} (as : List α) {b : α} (bs : List α) : a < b → lt (a::as) (b::bs)\n \n | tail {a : α} {as : List α} {b : α} {bs : List α} : ¬ a < b → ¬ b < a → lt as bs → lt (a::as) (b::bs)",
"start": [
151,
1
],
"end": [
161,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "List.hasDecidableLt",
"code": "instance hasDecidableLt [LT α] [h : DecidableRel (α := α) (· < ·)] : (l₁ l₂ : List α) → Decidable (l₁ < l₂)\n | [], [] => isFalse nofun\n | [], _::_ => isTrue (List.lt.nil _ _)\n | _::_, [] => isFalse nofun\n | a::as, b::bs =>\n match h a b with\n | isTrue h₁ => isTrue (List.lt.head _ _ h₁)\n | isFalse h₁ =>\n match h b a with\n | isTrue h₂ => isFalse (fun h => match h with\n | List.lt.head _ _ h₁' => absurd h₁' h₁\n | List.lt.tail _ h₂' _ => absurd h₂ h₂')\n | isFalse h₂ =>\n match hasDecidableLt as bs with\n | isTrue h₃ => isTrue (List.lt.tail h₁ h₂ h₃)\n | isFalse h₃ => isFalse (fun h => match h with\n | List.lt.head _ _ h₁' => absurd h₁' h₁\n | List.lt.tail _ _ h₃' => absurd h₃' h₃)",
"start": [
165,
1
],
"end": [
182,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.le",
"code": "@[reducible] protected def le [LT α] (a b : List α) : Prop := ¬ b < a",
"start": [
184,
1
],
"end": [
185,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?",
"code": "def get? : (as : List α) → (i : Nat) → Option α\n | a::_, 0 => some a\n | _::as, n+1 => get? as n\n | _, _ => none",
"start": [
196,
1
],
"end": [
205,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_nil",
"code": "@[simp] theorem get?_nil : @get? α [] n = none",
"start": [
207,
1
],
"end": [
207,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_cons_zero",
"code": "@[simp] theorem get?_cons_zero : @get? α (a::l) 0 = some a",
"start": [
208,
1
],
"end": [
208,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_cons_succ",
"code": "@[simp] theorem get?_cons_succ : @get? α (a::l) (n+1) = get? l n",
"start": [
209,
1
],
"end": [
209,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ext_get?",
"code": "theorem ext_get? : ∀ {l₁ l₂ : List α}, (∀ n, l₁.get? n = l₂.get? n) → l₁ = l₂",
"start": [
211,
1
],
"end": [
217,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ext",
"code": "@[deprecated (since := \"2024-06-07\")] abbrev ext := @ext_get?",
"start": [
219,
1
],
"end": [
220,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD",
"code": "def getD (as : List α) (i : Nat) (fallback : α) : α :=\n (as.get? i).getD fallback",
"start": [
224,
1
],
"end": [
231,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD_nil",
"code": "@[simp] theorem getD_nil : getD [] n d = d",
"start": [
233,
1
],
"end": [
233,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD_cons_zero",
"code": "@[simp] theorem getD_cons_zero : getD (x :: xs) 0 d = x",
"start": [
234,
1
],
"end": [
234,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD_cons_succ",
"code": "@[simp] theorem getD_cons_succ : getD (x :: xs) (n + 1) d = getD xs n d",
"start": [
235,
1
],
"end": [
235,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast",
"code": "def getLast : ∀ (as : List α), as ≠ [] → α\n | [], h => absurd rfl h\n | [a], _ => a\n | _::b::as, _ => getLast (b::as) (fun h => List.noConfusion h)",
"start": [
239,
1
],
"end": [
245,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?",
"code": "def getLast? : List α → Option α\n | [] => none\n | a::as => some (getLast (a::as) (fun h => List.noConfusion h))",
"start": [
249,
1
],
"end": [
257,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_nil",
"code": "@[simp] theorem getLast?_nil : @getLast? α [] = none",
"start": [
259,
1
],
"end": [
259,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD",
"code": "def getLastD : (as : List α) → (fallback : α) → α\n | [], a₀ => a₀\n | a::as, _ => getLast (a::as) (fun h => List.noConfusion h)",
"start": [
263,
1
],
"end": [
271,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_nil",
"code": "@[simp] theorem getLastD_nil (a) : @getLastD α [] a = a",
"start": [
273,
1
],
"end": [
273,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_cons",
"code": "@[simp] theorem getLastD_cons (a b l) : @getLastD α (b::l) a = getLastD l b",
"start": [
274,
1
],
"end": [
274,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head",
"code": "def head : (as : List α) → as ≠ [] → α\n | a::_, _ => a",
"start": [
280,
1
],
"end": [
284,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head_cons",
"code": "@[simp] theorem head_cons : @head α (a::l) h = a",
"start": [
286,
1
],
"end": [
286,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?",
"code": "def head? : List α → Option α\n | [] => none\n | a::_ => some a",
"start": [
290,
1
],
"end": [
298,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?_nil",
"code": "@[simp] theorem head?_nil : @head? α [] = none",
"start": [
300,
1
],
"end": [
300,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?_cons",
"code": "@[simp] theorem head?_cons : @head? α (a::l) = some a",
"start": [
301,
1
],
"end": [
301,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.headD",
"code": "def headD : (as : List α) → (fallback : α) → α\n | [], fallback => fallback\n | a::_, _ => a",
"start": [
305,
1
],
"end": [
313,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.headD_nil",
"code": "@[simp 1100] theorem headD_nil : @headD α [] d = d",
"start": [
315,
1
],
"end": [
315,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.headD_cons",
"code": "@[simp 1100] theorem headD_cons : @headD α (a::l) d = a",
"start": [
316,
1
],
"end": [
316,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail?",
"code": "def tail? : List α → Option (List α)\n | [] => none\n | _::as => some as",
"start": [
320,
1
],
"end": [
328,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail?_nil",
"code": "@[simp] theorem tail?_nil : @tail? α [] = none",
"start": [
330,
1
],
"end": [
330,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail?_cons",
"code": "@[simp] theorem tail?_cons : @tail? α (a::l) = some l",
"start": [
331,
1
],
"end": [
331,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tailD",
"code": "def tailD (list fallback : List α) : List α :=\n match list with\n | [] => fallback\n | _ :: tl => tl",
"start": [
335,
1
],
"end": [
344,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tailD_nil",
"code": "@[simp 1100] theorem tailD_nil : @tailD α [] l' = l'",
"start": [
346,
1
],
"end": [
346,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tailD_cons",
"code": "@[simp 1100] theorem tailD_cons : @tailD α (a::l) l' = l",
"start": [
347,
1
],
"end": [
347,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map",
"code": "@[specialize] def map (f : α → β) : List α → List β\n | [] => []\n | a::as => f a :: map f as",
"start": [
357,
1
],
"end": [
363,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_nil",
"code": "@[simp] theorem map_nil {f : α → β} : map f [] = []",
"start": [
365,
1
],
"end": [
365,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_cons",
"code": "@[simp] theorem map_cons (f : α → β) a l : map f (a :: l) = f a :: map f l",
"start": [
366,
1
],
"end": [
366,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter",
"code": "def filter (p : α → Bool) : List α → List α\n | [] => []\n | a::as => match p a with\n | true => a :: filter p as\n | false => filter p as",
"start": [
370,
1
],
"end": [
380,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_nil",
"code": "@[simp] theorem filter_nil (p : α → Bool) : filter p [] = []",
"start": [
382,
1
],
"end": [
382,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap",
"code": "@[specialize] def filterMap (f : α → Option β) : List α → List β\n | [] => []\n | a::as =>\n match f a with\n | none => filterMap f as\n | some b => b :: filterMap f as",
"start": [
386,
1
],
"end": [
401,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_nil",
"code": "@[simp] theorem filterMap_nil (f : α → Option β) : filterMap f [] = []",
"start": [
403,
1
],
"end": [
403,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_cons",
"code": "theorem filterMap_cons (f : α → Option β) (a : α) (l : List α) :\n filterMap f (a :: l) =\n match f a with\n | none => filterMap f l\n | some b => b :: filterMap f l",
"start": [
404,
1
],
"end": [
408,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr",
"code": "@[specialize] def foldr (f : α → β → β) (init : β) : List α → β\n | [] => init\n | a :: l => f a (foldr f init l)",
"start": [
412,
1
],
"end": [
418,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_nil",
"code": "@[simp] theorem foldr_nil : [].foldr f b = b",
"start": [
420,
1
],
"end": [
420,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_cons",
"code": "@[simp] theorem foldr_cons (l : List α) : (a :: l).foldr f b = f a (l.foldr f b)",
"start": [
421,
1
],
"end": [
421,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux",
"code": "def reverseAux : List α → List α → List α\n | [], r => r\n | a::l, r => reverseAux l (a::r)",
"start": [
425,
1
],
"end": [
428,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_nil",
"code": "@[simp] theorem reverseAux_nil : reverseAux [] r = r",
"start": [
430,
1
],
"end": [
430,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_cons",
"code": "@[simp] theorem reverseAux_cons : reverseAux (a::l) r = reverseAux l (a::r)",
"start": [
431,
1
],
"end": [
431,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse",
"code": "def reverse (as : List α) : List α :=\n reverseAux as []",
"start": [
433,
1
],
"end": [
442,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_nil",
"code": "@[simp] theorem reverse_nil : reverse ([] : List α) = []",
"start": [
444,
1
],
"end": [
444,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_reverseAux",
"code": "theorem reverseAux_reverseAux (as bs cs : List α) : reverseAux (reverseAux as bs) cs = reverseAux bs (reverseAux (reverseAux as []) cs)",
"start": [
446,
1
],
"end": [
449,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append",
"code": "protected def append : (xs ys : List α) → List α\n | [], bs => bs\n | a::as, bs => a :: List.append as bs",
"start": [
453,
1
],
"end": [
459,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.appendTR",
"code": "def appendTR (as bs : List α) : List α :=\n reverseAux as.reverse bs",
"start": [
461,
1
],
"end": [
468,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq_appendTR",
"code": "@[csimp] theorem append_eq_appendTR : @List.append = @appendTR",
"start": [
470,
1
],
"end": [
477,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq",
"code": "@[simp] theorem append_eq (as bs : List α) : List.append as bs = as ++ bs",
"start": [
481,
1
],
"end": [
481,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "List.nil_append",
"code": "@[simp] theorem nil_append (as : List α) : [] ++ as = as",
"start": [
483,
1
],
"end": [
483,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_append",
"code": "@[simp] theorem cons_append (a : α) (as bs : List α) : (a::as) ++ bs = a::(as ++ bs)",
"start": [
484,
1
],
"end": [
484,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_nil",
"code": "@[simp] theorem append_nil (as : List α) : as ++ [] = as",
"start": [
486,
1
],
"end": [
490,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_append",
"code": "@[simp] theorem length_append (as bs : List α) : (as ++ bs).length = as.length + bs.length",
"start": [
496,
1
],
"end": [
499,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_assoc",
"code": "@[simp] theorem append_assoc (as bs cs : List α) : (as ++ bs) ++ cs = as ++ (bs ++ cs)",
"start": [
501,
1
],
"end": [
504,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_cons",
"code": "theorem append_cons (as : List α) (b : α) (bs : List α) : as ++ b :: bs = as ++ [b] ++ bs",
"start": [
508,
1
],
"end": [
509,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_eq_append",
"code": "@[simp] theorem concat_eq_append (as : List α) (a : α) : as.concat a = as ++ [a]",
"start": [
511,
1
],
"end": [
512,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_eq_append",
"code": "theorem reverseAux_eq_append (as bs : List α) : reverseAux as bs = reverseAux as [] ++ bs",
"start": [
514,
1
],
"end": [
520,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_cons",
"code": "@[simp] theorem reverse_cons (a : α) (as : List α) : reverse (a :: as) = reverse as ++ [a]",
"start": [
522,
1
],
"end": [
524,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join",
"code": "def join : List (List α) → List α\n | [] => []\n | a :: as => a ++ join as",
"start": [
528,
1
],
"end": [
534,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join_nil",
"code": "@[simp] theorem join_nil : List.join ([] : List (List α)) = []",
"start": [
536,
1
],
"end": [
536,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join_cons",
"code": "@[simp] theorem join_cons : (l :: ls).join = l ++ ls.join",
"start": [
537,
1
],
"end": [
537,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.pure",
"code": "@[inline] protected def pure {α : Type u} (a : α) : List α := [a]",
"start": [
541,
1
],
"end": [
542,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind",
"code": "@[inline] protected def bind {α : Type u} {β : Type v} (a : List α) (b : α → List β) : List β := join (map b a)",
"start": [
546,
1
],
"end": [
551,
112
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_nil",
"code": "@[simp] theorem bind_nil (f : α → List β) : List.bind [] f = []",
"start": [
553,
1
],
"end": [
553,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_cons",
"code": "@[simp] theorem bind_cons x xs (f : α → List β) :\n List.bind (x :: xs) f = f x ++ List.bind xs f",
"start": [
554,
1
],
"end": [
555,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.nil_bind",
"code": "@[deprecated bind_nil (since := \"2024-06-15\")] abbrev nil_bind := @bind_nil",
"start": [
558,
1
],
"end": [
558,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_bind",
"code": "@[deprecated bind_cons (since := \"2024-06-15\")] abbrev cons_bind := @bind_cons",
"start": [
560,
1
],
"end": [
560,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate",
"code": "def replicate : (n : Nat) → (a : α) → List α\n | 0, _ => []\n | n+1, a => a :: replicate n a",
"start": [
564,
1
],
"end": [
570,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate_zero",
"code": "@[simp] theorem replicate_zero : replicate 0 a = []",
"start": [
572,
1
],
"end": [
572,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate_succ",
"code": "theorem replicate_succ (a : α) (n) : replicate (n+1) a = a :: replicate n a",
"start": [
573,
1
],
"end": [
573,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_replicate",
"code": "@[simp] theorem length_replicate (n : Nat) (a : α) : (replicate n a).length = n",
"start": [
575,
1
],
"end": [
578,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.empty_eq",
"code": "@[simp] theorem empty_eq : (∅ : List α) = []",
"start": [
590,
1
],
"end": [
590,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEmpty",
"code": "def isEmpty : List α → Bool\n | [] => true\n | _ :: _ => false",
"start": [
594,
1
],
"end": [
602,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEmpty_nil",
"code": "@[simp] theorem isEmpty_nil : ([] : List α).isEmpty = true",
"start": [
604,
1
],
"end": [
604,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEmpty_cons",
"code": "@[simp] theorem isEmpty_cons : (x :: xs : List α).isEmpty = false",
"start": [
605,
1
],
"end": [
605,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem",
"code": "def elem [BEq α] (a : α) : List α → Bool\n | [] => false\n | b::bs => match a == b with\n | true => true\n | false => elem a bs",
"start": [
609,
1
],
"end": [
619,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_nil",
"code": "@[simp] theorem elem_nil [BEq α] : ([] : List α).elem a = false",
"start": [
621,
1
],
"end": [
621,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_cons",
"code": "theorem elem_cons [BEq α] {a : α} :\n (b::bs).elem a = match a == b with | true => true | false => bs.elem a",
"start": [
622,
1
],
"end": [
623,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.notElem",
"code": "@[deprecated (since := \"2024-06-15\")]\ndef notElem [BEq α] (a : α) (as : List α) : Bool :=\n !(as.elem a)",
"start": [
625,
1
],
"end": [
628,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "List.contains",
"code": "@[inherit_doc elem] abbrev contains [BEq α] (as : List α) (a : α) : Bool :=\n elem a as",
"start": [
632,
1
],
"end": [
633,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "List.contains_nil",
"code": "@[simp] theorem contains_nil [BEq α] : ([] : List α).contains a = false",
"start": [
635,
1
],
"end": [
635,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "List.Mem",
"code": "inductive Mem (a : α) : List α → Prop\n \n | head (as : List α) : Mem a (a::as)\n \n | tail (b : α) {as : List α} : Mem a as → Mem a (b::as)",
"start": [
639,
1
],
"end": [
648,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_of_elem_eq_true",
"code": "theorem mem_of_elem_eq_true [BEq α] [LawfulBEq α] {a : α} {as : List α} : elem a as = true → a ∈ as",
"start": [
653,
1
],
"end": [
660,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_eq_true_of_mem",
"code": "theorem elem_eq_true_of_mem [BEq α] [LawfulBEq α] {a : α} {as : List α} (h : a ∈ as) : elem a as = true",
"start": [
662,
1
],
"end": [
665,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append_of_mem_left",
"code": "theorem mem_append_of_mem_left {a : α} {as : List α} (bs : List α) : a ∈ as → a ∈ as ++ bs",
"start": [
670,
1
],
"end": [
674,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append_of_mem_right",
"code": "theorem mem_append_of_mem_right {b : α} {bs : List α} (as : List α) : b ∈ bs → b ∈ as ++ bs",
"start": [
676,
1
],
"end": [
680,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.decidableBEx",
"code": "instance decidableBEx (p : α → Prop) [DecidablePred p] :\n ∀ l : List α, Decidable (Exists fun x => x ∈ l ∧ p x)\n | [] => isFalse nofun\n | x :: xs =>\n if h₁ : p x then isTrue ⟨x, .head .., h₁⟩ else\n match decidableBEx p xs with\n | isTrue h₂ => isTrue <| let ⟨y, hm, hp⟩ := h₂; ⟨y, .tail _ hm, hp⟩\n | isFalse h₂ => isFalse fun\n | ⟨y, .tail _ h, hp⟩ => h₂ ⟨y, h, hp⟩\n | ⟨_, .head .., hp⟩ => h₁ hp",
"start": [
682,
1
],
"end": [
691,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.decidableBAll",
"code": "instance decidableBAll (p : α → Prop) [DecidablePred p] :\n ∀ l : List α, Decidable (∀ x, x ∈ l → p x)\n | [] => isTrue nofun\n | x :: xs =>\n if h₁ : p x then\n match decidableBAll p xs with\n | isTrue h₂ => isTrue fun\n | y, .tail _ h => h₂ y h\n | _, .head .. => h₁\n | isFalse h₂ => isFalse fun H => h₂ fun y hm => H y (.tail _ hm)\n else isFalse fun H => h₁ <| H x (.head ..)",
"start": [
693,
1
],
"end": [
703,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take",
"code": "def take : Nat → List α → List α\n | 0, _ => []\n | _+1, [] => []\n | n+1, a::as => a :: take n as",
"start": [
709,
1
],
"end": [
718,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_nil",
"code": "@[simp] theorem take_nil : ([] : List α).take i = []",
"start": [
720,
1
],
"end": [
720,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_zero",
"code": "@[simp] theorem take_zero (l : List α) : l.take 0 = []",
"start": [
721,
1
],
"end": [
721,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_cons_succ",
"code": "@[simp] theorem take_cons_succ : (a::as).take (i+1) = a :: as.take i",
"start": [
722,
1
],
"end": [
722,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop",
"code": "def drop : Nat → List α → List α\n | 0, a => a\n | _+1, [] => []\n | n+1, _::as => drop n as",
"start": [
726,
1
],
"end": [
735,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_nil",
"code": "@[simp] theorem drop_nil : ([] : List α).drop i = []",
"start": [
737,
1
],
"end": [
738,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_zero",
"code": "@[simp] theorem drop_zero (l : List α) : l.drop 0 = l",
"start": [
739,
1
],
"end": [
739,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_succ_cons",
"code": "@[simp] theorem drop_succ_cons : (a :: l).drop (n + 1) = l.drop n",
"start": [
740,
1
],
"end": [
740,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_eq_nil_of_le",
"code": "theorem drop_eq_nil_of_le {as : List α} {i : Nat} (h : as.length ≤ i) : as.drop i = []",
"start": [
742,
1
],
"end": [
746,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile",
"code": "def takeWhile (p : α → Bool) : (xs : List α) → List α\n | [] => []\n | hd :: tl => match p hd with\n | true => hd :: takeWhile p tl\n | false => []",
"start": [
750,
1
],
"end": [
759,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_nil",
"code": "@[simp] theorem takeWhile_nil : ([] : List α).takeWhile p = []",
"start": [
761,
1
],
"end": [
761,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile",
"code": "def dropWhile (p : α → Bool) : List α → List α\n | [] => []\n | a::l => match p a with\n | true => dropWhile p l\n | false => a::l",
"start": [
765,
1
],
"end": [
776,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_nil",
"code": "@[simp] theorem dropWhile_nil : ([] : List α).dropWhile p = []",
"start": [
778,
1
],
"end": [
778,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.partition",
"code": "@[inline] def partition (p : α → Bool) (as : List α) : List α × List α :=\n loop as ([], [])\nwhere\n @[specialize] loop : List α → List α × List α → List α × List α\n | [], (bs, cs) => (bs.reverse, cs.reverse)\n | a::as, (bs, cs) =>\n match p a with\n | true => loop as (a::bs, cs)\n | false => loop as (bs, a::cs)",
"start": [
782,
1
],
"end": [
800,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast",
"code": "def dropLast {α} : List α → List α\n | [] => []\n | [_] => []\n | a::as => a :: dropLast as",
"start": [
804,
1
],
"end": [
813,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_nil",
"code": "@[simp] theorem dropLast_nil : ([] : List α).dropLast = []",
"start": [
815,
1
],
"end": [
815,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_single",
"code": "@[simp] theorem dropLast_single : [x].dropLast = []",
"start": [
816,
1
],
"end": [
816,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_cons₂",
"code": "@[simp] theorem dropLast_cons₂ :\n (x::y::zs).dropLast = x :: (y::zs).dropLast",
"start": [
817,
1
],
"end": [
818,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_dropLast_cons",
"code": "@[simp] theorem length_dropLast_cons (a : α) (as : List α) : (a :: as).dropLast.length = as.length",
"start": [
820,
1
],
"end": [
825,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf",
"code": "def isPrefixOf [BEq α] : List α → List α → Bool\n | [], _ => true\n | _, [] => false\n | a::as, b::bs => a == b && isPrefixOf as bs",
"start": [
829,
1
],
"end": [
834,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_nil_left",
"code": "@[simp] theorem isPrefixOf_nil_left [BEq α] : isPrefixOf ([] : List α) l = true",
"start": [
836,
1
],
"end": [
837,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_cons_nil",
"code": "@[simp] theorem isPrefixOf_cons_nil [BEq α] : isPrefixOf (a::as) ([] : List α) = false",
"start": [
838,
1
],
"end": [
838,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_cons₂",
"code": "theorem isPrefixOf_cons₂ [BEq α] {a : α} :\n isPrefixOf (a::as) (b::bs) = (a == b && isPrefixOf as bs)",
"start": [
839,
1
],
"end": [
840,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf?",
"code": "def isPrefixOf? [BEq α] : List α → List α → Option (List α)\n | [], l₂ => some l₂\n | _, [] => none\n | (x₁ :: l₁), (x₂ :: l₂) =>\n if x₁ == x₂ then isPrefixOf? l₁ l₂ else none",
"start": [
844,
1
],
"end": [
849,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isSuffixOf",
"code": "def isSuffixOf [BEq α] (l₁ l₂ : List α) : Bool :=\n isPrefixOf l₁.reverse l₂.reverse",
"start": [
853,
1
],
"end": [
856,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isSuffixOf_nil_left",
"code": "@[simp] theorem isSuffixOf_nil_left [BEq α] : isSuffixOf ([] : List α) l = true",
"start": [
858,
1
],
"end": [
859,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isSuffixOf?",
"code": "def isSuffixOf? [BEq α] (l₁ l₂ : List α) : Option (List α) :=\n Option.map List.reverse <| isPrefixOf? l₁.reverse l₂.reverse",
"start": [
863,
1
],
"end": [
865,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateLeft",
"code": "def rotateLeft (xs : List α) (n : Nat := 1) : List α :=\n let len := xs.length\n if len ≤ 1 then\n xs\n else\n let n := n % len\n let b := xs.take n\n let e := xs.drop n\n e ++ b",
"start": [
869,
1
],
"end": [
884,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateLeft_nil",
"code": "@[simp] theorem rotateLeft_nil : ([] : List α).rotateLeft n = []",
"start": [
886,
1
],
"end": [
886,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateRight",
"code": "def rotateRight (xs : List α) (n : Nat := 1) : List α :=\n let len := xs.length\n if len ≤ 1 then\n xs\n else\n let n := len - n % len\n let b := xs.take n\n let e := xs.drop n\n e ++ b",
"start": [
890,
1
],
"end": [
905,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateRight_nil",
"code": "@[simp] theorem rotateRight_nil : ([] : List α).rotateRight n = []",
"start": [
907,
1
],
"end": [
907,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace",
"code": "def replace [BEq α] : List α → α → α → List α\n | [], _, _ => []\n | a::as, b, c => match b == a with\n | true => c::as\n | false => a :: replace as b c",
"start": [
913,
1
],
"end": [
923,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_nil",
"code": "@[simp] theorem replace_nil [BEq α] : ([] : List α).replace a b = []",
"start": [
925,
1
],
"end": [
925,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_cons",
"code": "theorem replace_cons [BEq α] {a : α} :\n (a::as).replace b c = match b == a with | true => c::as | false => a :: replace as b c",
"start": [
926,
1
],
"end": [
928,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert",
"code": "@[inline] protected def insert [BEq α] (a : α) (l : List α) : List α :=\n if l.elem a then l else a :: l",
"start": [
932,
1
],
"end": [
934,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase",
"code": "protected def erase {α} [BEq α] : List α → α → List α\n | [], _ => []\n | a::as, b => match a == b with\n | true => as\n | false => a :: List.erase as b",
"start": [
938,
1
],
"end": [
947,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_nil",
"code": "@[simp] theorem erase_nil [BEq α] (a : α) : [].erase a = []",
"start": [
949,
1
],
"end": [
949,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_cons",
"code": "theorem erase_cons [BEq α] (a b : α) (l : List α) :\n (b :: l).erase a = if b == a then l else b :: l.erase a",
"start": [
950,
1
],
"end": [
952,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseIdx",
"code": "def eraseIdx : List α → Nat → List α\n | [], _ => []\n | _::as, 0 => as\n | a::as, n+1 => a :: eraseIdx as n",
"start": [
956,
1
],
"end": [
965,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseIdx_nil",
"code": "@[simp] theorem eraseIdx_nil : ([] : List α).eraseIdx i = []",
"start": [
967,
1
],
"end": [
967,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseIdx_cons_zero",
"code": "@[simp] theorem eraseIdx_cons_zero : (a::as).eraseIdx 0 = as",
"start": [
968,
1
],
"end": [
968,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseIdx_cons_succ",
"code": "@[simp] theorem eraseIdx_cons_succ : (a::as).eraseIdx (i+1) = a :: as.eraseIdx i",
"start": [
969,
1
],
"end": [
969,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?",
"code": "def find? (p : α → Bool) : List α → Option α\n | [] => none\n | a::as => match p a with\n | true => some a\n | false => find? p as",
"start": [
973,
1
],
"end": [
984,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_nil",
"code": "@[simp] theorem find?_nil : ([] : List α).find? p = none",
"start": [
986,
1
],
"end": [
986,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_cons",
"code": "theorem find?_cons : (a::as).find? p = match p a with | true => some a | false => as.find? p",
"start": [
987,
1
],
"end": [
988,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?",
"code": "def findSome? (f : α → Option β) : List α → Option β\n | [] => none\n | a::as => match f a with\n | some b => some b\n | none => findSome? f as",
"start": [
992,
1
],
"end": [
1001,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_nil",
"code": "@[simp] theorem findSome?_nil : ([] : List α).findSome? f = none",
"start": [
1003,
1
],
"end": [
1003,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_cons",
"code": "theorem findSome?_cons {f : α → Option β} :\n (a::as).findSome? f = match f a with | some b => some b | none => as.findSome? f",
"start": [
1004,
1
],
"end": [
1006,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup",
"code": "def lookup [BEq α] : α → List (α × β) → Option β\n | _, [] => none\n | a, (k,b)::es => match a == k with\n | true => some b\n | false => lookup a es",
"start": [
1010,
1
],
"end": [
1021,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_nil",
"code": "@[simp] theorem lookup_nil [BEq α] : ([] : List (α × β)).lookup a = none",
"start": [
1023,
1
],
"end": [
1023,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_cons",
"code": "theorem lookup_cons [BEq α] {k : α} :\n ((k,b)::es).lookup a = match a == k with | true => some b | false => es.lookup a",
"start": [
1024,
1
],
"end": [
1026,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any",
"code": "def any : List α → (α → Bool) → Bool\n | [], _ => false\n | h :: t, p => p h || any t p",
"start": [
1032,
1
],
"end": [
1040,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_nil",
"code": "@[simp] theorem any_nil : [].any f = false",
"start": [
1042,
1
],
"end": [
1042,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_cons",
"code": "@[simp] theorem any_cons : (a::l).any f = (f a || l.any f)",
"start": [
1043,
1
],
"end": [
1043,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all",
"code": "def all : List α → (α → Bool) → Bool\n | [], _ => true\n | h :: t, p => p h && all t p",
"start": [
1047,
1
],
"end": [
1055,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_nil",
"code": "@[simp] theorem all_nil : [].all f = true",
"start": [
1057,
1
],
"end": [
1057,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_cons",
"code": "@[simp] theorem all_cons : (a::l).all f = (f a && l.all f)",
"start": [
1058,
1
],
"end": [
1058,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.or",
"code": "def or (bs : List Bool) : Bool := bs.any id",
"start": [
1062,
1
],
"end": [
1066,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.or_nil",
"code": "@[simp] theorem or_nil : [].or = false",
"start": [
1068,
1
],
"end": [
1068,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.or_cons",
"code": "@[simp] theorem or_cons : (a::l).or = (a || l.or)",
"start": [
1069,
1
],
"end": [
1069,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.and",
"code": "def and (bs : List Bool) : Bool := bs.all id",
"start": [
1073,
1
],
"end": [
1077,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.and_nil",
"code": "@[simp] theorem and_nil : [].and = true",
"start": [
1079,
1
],
"end": [
1079,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.and_cons",
"code": "@[simp] theorem and_cons : (a::l).and = (a && l.and)",
"start": [
1080,
1
],
"end": [
1080,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith",
"code": "@[specialize] def zipWith (f : α → β → γ) : (xs : List α) → (ys : List β) → List γ\n | x::xs, y::ys => f x y :: zipWith f xs ys\n | _, _ => []",
"start": [
1086,
1
],
"end": [
1092,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_nil_left",
"code": "@[simp] theorem zipWith_nil_left {f : α → β → γ} : zipWith f [] l = []",
"start": [
1094,
1
],
"end": [
1094,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_nil_right",
"code": "@[simp] theorem zipWith_nil_right {f : α → β → γ} : zipWith f l [] = []",
"start": [
1095,
1
],
"end": [
1095,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_cons_cons",
"code": "@[simp] theorem zipWith_cons_cons {f : α → β → γ} :\n zipWith f (a :: as) (b :: bs) = f a b :: zipWith f as bs",
"start": [
1096,
1
],
"end": [
1097,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip",
"code": "def zip : List α → List β → List (Prod α β) :=\n zipWith Prod.mk",
"start": [
1101,
1
],
"end": [
1107,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_nil_left",
"code": "@[simp] theorem zip_nil_left : zip ([] : List α) (l : List β) = []",
"start": [
1109,
1
],
"end": [
1109,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_nil_right",
"code": "@[simp] theorem zip_nil_right : zip (l : List α) ([] : List β) = []",
"start": [
1110,
1
],
"end": [
1110,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_cons_cons",
"code": "@[simp] theorem zip_cons_cons : zip (a :: as) (b :: bs) = (a, b) :: zip as bs",
"start": [
1111,
1
],
"end": [
1111,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll",
"code": "def zipWithAll (f : Option α → Option β → γ) : List α → List β → List γ\n | [], bs => bs.map fun b => f none (some b)\n | a :: as, [] => (a :: as).map fun a => f (some a) none\n | a :: as, b :: bs => f a b :: zipWithAll f as bs",
"start": [
1115,
1
],
"end": [
1123,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_nil_right",
"code": "@[simp] theorem zipWithAll_nil_right :\n zipWithAll f as [] = as.map fun a => f (some a) none",
"start": [
1125,
1
],
"end": [
1127,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_nil_left",
"code": "@[simp] theorem zipWithAll_nil_left :\n zipWithAll f [] bs = bs.map fun b => f none (some b)",
"start": [
1128,
1
],
"end": [
1129,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_cons_cons",
"code": "@[simp] theorem zipWithAll_cons_cons :\n zipWithAll f (a :: as) (b :: bs) = f (some a) (some b) :: zipWithAll f as bs",
"start": [
1130,
1
],
"end": [
1131,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.unzip",
"code": "def unzip : List (α × β) → List α × List β\n | [] => ([], [])\n | (a, b) :: t => match unzip t with | (al, bl) => (a::al, b::bl)",
"start": [
1135,
1
],
"end": [
1141,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "List.unzip_nil",
"code": "@[simp] theorem unzip_nil : ([] : List (α × β)).unzip = ([], [])",
"start": [
1143,
1
],
"end": [
1143,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.unzip_cons",
"code": "@[simp] theorem unzip_cons {h : α × β} :\n (h :: t).unzip = match unzip t with | (al, bl) => (h.1::al, h.2::bl)",
"start": [
1144,
1
],
"end": [
1145,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.range",
"code": "def range (n : Nat) : List Nat :=\n loop n []\nwhere\n loop : Nat → List Nat → List Nat\n | 0, ns => ns\n | n+1, ns => loop n (n::ns)",
"start": [
1151,
1
],
"end": [
1160,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.range_zero",
"code": "@[simp] theorem range_zero : range 0 = []",
"start": [
1162,
1
],
"end": [
1162,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.iota",
"code": "def iota : Nat → List Nat\n | 0 => []\n | m@(n+1) => m :: iota n",
"start": [
1166,
1
],
"end": [
1172,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.iota_zero",
"code": "@[simp] theorem iota_zero : iota 0 = []",
"start": [
1174,
1
],
"end": [
1174,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.iota_succ",
"code": "@[simp] theorem iota_succ : iota (i+1) = (i+1) :: iota i",
"start": [
1175,
1
],
"end": [
1175,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enumFrom",
"code": "def enumFrom : Nat → List α → List (Nat × α)\n | _, [] => nil\n | n, x :: xs => (n, x) :: enumFrom (n + 1) xs",
"start": [
1179,
1
],
"end": [
1185,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enumFrom_nil",
"code": "@[simp] theorem enumFrom_nil : ([] : List α).enumFrom i = []",
"start": [
1187,
1
],
"end": [
1187,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enumFrom_cons",
"code": "@[simp] theorem enumFrom_cons : (a::as).enumFrom i = (i, a) :: as.enumFrom (i+1)",
"start": [
1188,
1
],
"end": [
1188,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enum",
"code": "def enum : List α → List (Nat × α) := enumFrom 0",
"start": [
1192,
1
],
"end": [
1196,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enum_nil",
"code": "@[simp] theorem enum_nil : ([] : List α).enum = []",
"start": [
1198,
1
],
"end": [
1198,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?",
"code": "def minimum? [Min α] : List α → Option α\n | [] => none\n | a::as => some <| as.foldl min a",
"start": [
1204,
1
],
"end": [
1212,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?",
"code": "def maximum? [Max α] : List α → Option α\n | [] => none\n | a::as => some <| as.foldl max a",
"start": [
1216,
1
],
"end": [
1224,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.intersperse",
"code": "def intersperse (sep : α) : List α → List α\n | [] => []\n | [x] => [x]\n | x::xs => x :: sep :: intersperse sep xs",
"start": [
1234,
1
],
"end": [
1244,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.intersperse_nil",
"code": "@[simp] theorem intersperse_nil (sep : α) : ([] : List α).intersperse sep = []",
"start": [
1246,
1
],
"end": [
1246,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "List.intersperse_single",
"code": "@[simp] theorem intersperse_single (sep : α) : [x].intersperse sep = [x]",
"start": [
1247,
1
],
"end": [
1247,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.intersperse_cons₂",
"code": "@[simp] theorem intersperse_cons₂ (sep : α) :\n (x::y::zs).intersperse sep = x::sep::((y::zs).intersperse sep)",
"start": [
1248,
1
],
"end": [
1249,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.intercalate",
"code": "def intercalate (sep : List α) (xs : List (List α)) : List α :=\n join (intersperse sep xs)",
"start": [
1253,
1
],
"end": [
1261,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseDups",
"code": "def eraseDups {α} [BEq α] (as : List α) : List α :=\n loop as []\nwhere\n loop : List α → List α → List α\n | [], bs => bs.reverse\n | a::as, bs => match bs.elem a with\n | true => loop as bs\n | false => loop as (a::bs)",
"start": [
1265,
1
],
"end": [
1276,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eraseReps",
"code": "def eraseReps {α} [BEq α] : List α → List α\n | [] => []\n | a::as => loop a as []\nwhere\n loop {α} [BEq α] : α → List α → List α → List α\n | a, [], rs => (a::rs).reverse\n | a, a'::as, rs => match a == a' with\n | true => loop a as rs\n | false => loop a' as (a::rs)",
"start": [
1280,
1
],
"end": [
1292,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.span",
"code": "@[inline] def span (p : α → Bool) (as : List α) : List α × List α :=\n loop as []\nwhere\n @[specialize] loop : List α → List α → List α × List α\n | [], rs => (rs.reverse, [])\n | a::as, rs => match p a with\n | true => loop as (a::rs)\n | false => (rs.reverse, a::as)",
"start": [
1296,
1
],
"end": [
1311,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.groupBy",
"code": "@[specialize] def groupBy (R : α → α → Bool) : List α → List (List α)\n | [] => []\n | a::as => loop as a [] []\nwhere\n @[specialize] loop : List α → α → List α → List (List α) → List (List α)\n | a::as, ag, g, gs => match R ag a with\n | true => loop as a (ag::g) gs\n | false => loop as a [] ((ag::g).reverse::gs)\n | [], ag, g, gs => ((ag::g).reverse::gs).reverse",
"start": [
1315,
1
],
"end": [
1330,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.removeAll",
"code": "def removeAll [BEq α] (xs ys : List α) : List α :=\n xs.filter (fun x => !ys.elem x)",
"start": [
1334,
1
],
"end": [
1339,
34
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Coe.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean",
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "Option.getM",
"code": "def getM [Alternative m] : Option α → m α\n | none => failure\n | some a => pure a",
"start": [
16,
1
],
"end": [
19,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toMonad",
"code": "@[deprecated getM (since := \"2024-04-17\")]\ndef toMonad [Monad m] [Alternative m] : Option α → m α := getM",
"start": [
21,
1
],
"end": [
22,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isSome",
"code": "@[inline] def isSome : Option α → Bool\n | some _ => true\n | none => false",
"start": [
24,
1
],
"end": [
27,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toBool",
"code": "@[deprecated isSome, inline] def toBool : Option α → Bool := isSome",
"start": [
29,
1
],
"end": [
29,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isNone",
"code": "@[inline] def isNone : Option α → Bool\n | some _ => false\n | none => true",
"start": [
31,
1
],
"end": [
34,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isEqSome",
"code": "@[inline] def isEqSome [BEq α] : Option α → α → Bool\n | some a, b => a == b\n | none, _ => false",
"start": [
36,
1
],
"end": [
41,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind",
"code": "@[inline] protected def bind : Option α → (α → Option β) → Option β\n | none, _ => none\n | some a, f => f a",
"start": [
43,
1
],
"end": [
45,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bindM",
"code": "@[inline] protected def bindM [Monad m] (f : α → m (Option β)) (o : Option α) : m (Option β) := do\n if let some a := o then\n return (← f a)\n else\n return none",
"start": [
47,
1
],
"end": [
52,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mapM",
"code": "@[inline] protected def mapM [Monad m] (f : α → m β) (o : Option α) : m (Option β) := do\n if let some a := o then\n return some (← f a)\n else\n return none",
"start": [
54,
1
],
"end": [
62,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_id",
"code": "theorem map_id : (Option.map id : Option α → Option α) = id",
"start": [
64,
1
],
"end": [
65,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.filter",
"code": "@[always_inline, inline] protected def filter (p : α → Bool) : Option α → Option α\n | some a => if p a then some a else none\n | none => none",
"start": [
67,
1
],
"end": [
70,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.all",
"code": "@[always_inline, inline] protected def all (p : α → Bool) : Option α → Bool\n | some a => p a\n | none => true",
"start": [
72,
1
],
"end": [
75,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.any",
"code": "@[always_inline, inline] protected def any (p : α → Bool) : Option α → Bool\n | some a => p a\n | none => false",
"start": [
77,
1
],
"end": [
80,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.orElse",
"code": "@[always_inline, macro_inline] protected def orElse : Option α → (Unit → Option α) → Option α\n | some a, _ => some a\n | none, b => b ()",
"start": [
82,
1
],
"end": [
87,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.lt",
"code": "@[inline] protected def lt (r : α → α → Prop) : Option α → Option α → Prop\n | none, some _ => True\n | some x, some y => r x y\n | _, _ => False",
"start": [
92,
1
],
"end": [
95,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.merge",
"code": "def merge (fn : α → α → α) : Option α → Option α → Option α\n | none , none => none\n | some x, none => some x\n | none , some y => some y\n | some x, some y => some <| fn x y",
"start": [
103,
1
],
"end": [
109,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD_none",
"code": "@[simp] theorem getD_none : getD none a = a",
"start": [
111,
1
],
"end": [
111,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD_some",
"code": "@[simp] theorem getD_some : getD (some a) b = a",
"start": [
112,
1
],
"end": [
112,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_none'",
"code": "@[simp] theorem map_none' (f : α → β) : none.map f = none",
"start": [
114,
1
],
"end": [
114,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_some'",
"code": "@[simp] theorem map_some' (a) (f : α → β) : (some a).map f = some (f a)",
"start": [
115,
1
],
"end": [
115,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.none_bind",
"code": "@[simp] theorem none_bind (f : α → Option β) : none.bind f = none",
"start": [
117,
1
],
"end": [
117,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.some_bind",
"code": "@[simp] theorem some_bind (a) (f : α → Option β) : (some a).bind f = f a",
"start": [
118,
1
],
"end": [
118,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.elim",
"code": "@[inline] protected def elim : Option α → β → (α → β) → β\n | some x, _, f => f x\n | none, y, _ => y",
"start": [
121,
1
],
"end": [
124,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.get",
"code": "@[inline] def get {α : Type u} : (o : Option α) → isSome o → α\n | some x, _ => x",
"start": [
126,
1
],
"end": [
128,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.guard",
"code": "@[inline] def guard (p : α → Prop) [DecidablePred p] (a : α) : Option α :=\n if p a then some a else none",
"start": [
130,
1
],
"end": [
132,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toList",
"code": "@[inline] def toList : Option α → List α\n | none => .nil\n | some a => .cons a .nil",
"start": [
134,
1
],
"end": [
139,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toArray",
"code": "@[inline] def toArray : Option α → Array α\n | none => List.toArray .nil\n | some a => List.toArray (.cons a .nil)",
"start": [
141,
1
],
"end": [
146,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.liftOrGet",
"code": "def liftOrGet (f : α → α → α) : Option α → Option α → Option α\n | none, none => none\n | some a, none => some a\n | none, some b => some b\n | some a, some b => some (f a b)",
"start": [
148,
1
],
"end": [
156,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.Rel",
"code": "inductive Rel (r : α → β → Prop) : Option α → Option β → Prop\n \n | some {a b} : r a b → Rel r (some a) (some b)\n \n | none : Rel r none none",
"start": [
158,
1
],
"end": [
164,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join",
"code": "@[simp, inline] def join (x : Option (Option α)) : Option α := x.bind id",
"start": [
166,
1
],
"end": [
167,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mapA",
"code": "@[inline] protected def mapA [Applicative m] {α β} (f : α → m β) : Option α → m (Option β)\n | none => pure none\n | some x => some <$> f x",
"start": [
169,
1
],
"end": [
172,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.sequence",
"code": "@[inline] def sequence [Monad m] {α : Type u} : Option (m α) → m (Option α)\n | none => pure none\n | some fn => some <$> fn",
"start": [
174,
1
],
"end": [
181,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.elimM",
"code": "@[inline] def elimM [Monad m] (x : m (Option α)) (y : m β) (z : α → m β) : m β :=\n do (← x).elim y z",
"start": [
183,
1
],
"end": [
185,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getDM",
"code": "@[inline] def getDM [Monad m] (x : Option α) (y : m α) : m α :=\n match x with\n | some a => pure a\n | none => y",
"start": [
187,
1
],
"end": [
191,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.all_none",
"code": "@[simp] theorem all_none : Option.all p none = true",
"start": [
203,
1
],
"end": [
203,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.all_some",
"code": "@[simp] theorem all_some : Option.all p (some x) = p x",
"start": [
204,
1
],
"end": [
204,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.min",
"code": "protected def min [Min α] : Option α → Option α → Option α\n | some x, some y => some (Min.min x y)\n | some x, none => some x\n | none, some y => some y\n | none, none => none",
"start": [
206,
1
],
"end": [
211,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.min_some_some",
"code": "@[simp] theorem min_some_some [Min α] {a b : α} : min (some a) (some b) = some (min a b)",
"start": [
215,
1
],
"end": [
215,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.min_some_none",
"code": "@[simp] theorem min_some_none [Min α] {a : α} : min (some a) none = some a",
"start": [
216,
1
],
"end": [
216,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.min_none_some",
"code": "@[simp] theorem min_none_some [Min α] {b : α} : min none (some b) = some b",
"start": [
217,
1
],
"end": [
217,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.min_none_none",
"code": "@[simp] theorem min_none_none [Min α] : min (none : Option α) none = none",
"start": [
218,
1
],
"end": [
218,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.max",
"code": "protected def max [Max α] : Option α → Option α → Option α\n | some x, some y => some (Max.max x y)\n | some x, none => some x\n | none, some y => some y\n | none, none => none",
"start": [
220,
1
],
"end": [
225,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.max_some_some",
"code": "@[simp] theorem max_some_some [Max α] {a b : α} : max (some a) (some b) = some (max a b)",
"start": [
229,
1
],
"end": [
229,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.max_some_none",
"code": "@[simp] theorem max_some_none [Max α] {a : α} : max (some a) none = some a",
"start": [
230,
1
],
"end": [
230,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.max_none_some",
"code": "@[simp] theorem max_none_some [Max α] {b : α} : max none (some b) = some b",
"start": [
231,
1
],
"end": [
231,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.max_none_none",
"code": "@[simp] theorem max_none_none [Max α] : max (none : Option α) none = none",
"start": [
232,
1
],
"end": [
232,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "liftOption",
"code": "def liftOption [Alternative m] : Option α → m α\n | some a => pure a\n | none => failure",
"start": [
254,
1
],
"end": [
256,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.tryCatch",
"code": "@[always_inline, inline] protected def Option.tryCatch (x : Option α) (handle : Unit → Option α) : Option α :=\n match x with\n | some _ => x\n | none => handle ()",
"start": [
258,
1
],
"end": [
261,
22
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Char/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean"
] | [
{
"full_name": "isValidChar",
"code": "@[inline, reducible] def isValidChar (n : UInt32) : Prop :=\n n < 0xd800 ∨ (0xdfff < n ∧ n < 0x110000)",
"start": [
9,
1
],
"end": [
14,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt",
"code": "protected def lt (a b : Char) : Prop := a.val < b.val",
"start": [
18,
1
],
"end": [
18,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.le",
"code": "protected def le (a b : Char) : Prop := a.val ≤ b.val",
"start": [
19,
1
],
"end": [
19,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isValidCharNat",
"code": "abbrev isValidCharNat (n : Nat) : Prop :=\n n < 0xd800 ∨ (0xdfff < n ∧ n < 0x110000)",
"start": [
30,
1
],
"end": [
32,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isValidUInt32",
"code": "theorem isValidUInt32 (n : Nat) (h : isValidCharNat n) : n < UInt32.size",
"start": [
34,
1
],
"end": [
41,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isValidChar_of_isValidCharNat",
"code": "theorem isValidChar_of_isValidCharNat (n : Nat) (h : isValidCharNat n) : isValidChar (UInt32.ofNat' n (isValidUInt32 n h))",
"start": [
43,
1
],
"end": [
46,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isValidChar_zero",
"code": "theorem isValidChar_zero : isValidChar 0",
"start": [
48,
1
],
"end": [
49,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.toNat",
"code": "@[inline] def toNat (c : Char) : Nat :=\n c.val.toNat",
"start": [
51,
1
],
"end": [
53,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.toUInt8",
"code": "@[inline] def toUInt8 (c : Char) : UInt8 :=\n c.val.toUInt8",
"start": [
55,
1
],
"end": [
57,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ofUInt8",
"code": "def ofUInt8 (n : UInt8) : Char := ⟨n.toUInt32, .inl (Nat.lt_trans n.1.2 (by decide))⟩",
"start": [
59,
1
],
"end": [
60,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isWhitespace",
"code": "def isWhitespace (c : Char) : Bool :=\n c = ' ' || c = '\\t' || c = '\\r' || c = '\\n'",
"start": [
65,
1
],
"end": [
67,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isUpper",
"code": "def isUpper (c : Char) : Bool :=\n c.val ≥ 65 && c.val ≤ 90",
"start": [
69,
1
],
"end": [
71,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isLower",
"code": "def isLower (c : Char) : Bool :=\n c.val ≥ 97 && c.val ≤ 122",
"start": [
73,
1
],
"end": [
75,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isAlpha",
"code": "def isAlpha (c : Char) : Bool :=\n c.isUpper || c.isLower",
"start": [
77,
1
],
"end": [
79,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isDigit",
"code": "def isDigit (c : Char) : Bool :=\n c.val ≥ 48 && c.val ≤ 57",
"start": [
81,
1
],
"end": [
83,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.isAlphanum",
"code": "def isAlphanum (c : Char) : Bool :=\n c.isAlpha || c.isDigit",
"start": [
85,
1
],
"end": [
87,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.toLower",
"code": "def toLower (c : Char) : Char :=\n let n := toNat c;\n if n >= 65 ∧ n <= 90 then ofNat (n + 32) else c",
"start": [
89,
1
],
"end": [
95,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.toUpper",
"code": "def toUpper (c : Char) : Char :=\n let n := toNat c;\n if n >= 97 ∧ n <= 122 then ofNat (n - 32) else c",
"start": [
97,
1
],
"end": [
103,
51
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/Except.lean | [
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Coe.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean"
] | [
{
"full_name": "Except.pure",
"code": "@[always_inline, inline]\nprotected def pure (a : α) : Except ε α :=\n Except.ok a",
"start": [
16,
1
],
"end": [
18,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.map",
"code": "@[always_inline, inline]\nprotected def map (f : α → β) : Except ε α → Except ε β\n | Except.error err => Except.error err\n | Except.ok v => Except.ok <| f v",
"start": [
20,
1
],
"end": [
23,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.map_id",
"code": "@[simp] theorem map_id : Except.map (ε := ε) (α := α) (β := α) id = id",
"start": [
25,
1
],
"end": [
28,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.mapError",
"code": "@[always_inline, inline]\nprotected def mapError (f : ε → ε') : Except ε α → Except ε' α\n | Except.error err => Except.error <| f err\n | Except.ok v => Except.ok v",
"start": [
30,
1
],
"end": [
33,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.bind",
"code": "@[always_inline, inline]\nprotected def bind (ma : Except ε α) (f : α → Except ε β) : Except ε β :=\n match ma with\n | Except.error err => Except.error err\n | Except.ok v => f v",
"start": [
35,
1
],
"end": [
39,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.toBool",
"code": "@[always_inline, inline]\nprotected def toBool : Except ε α → Bool\n | Except.ok _ => true\n | Except.error _ => false",
"start": [
41,
1
],
"end": [
45,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.isOk",
"code": "abbrev isOk : Except ε α → Bool := Except.toBool",
"start": [
47,
1
],
"end": [
47,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.toOption",
"code": "@[always_inline, inline]\nprotected def toOption : Except ε α → Option α\n | Except.ok a => some a\n | Except.error _ => none",
"start": [
49,
1
],
"end": [
52,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.tryCatch",
"code": "@[always_inline, inline]\nprotected def tryCatch (ma : Except ε α) (handle : ε → Except ε α) : Except ε α :=\n match ma with\n | Except.ok a => Except.ok a\n | Except.error e => handle e",
"start": [
54,
1
],
"end": [
58,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Except.orElseLazy",
"code": "def orElseLazy (x : Except ε α) (y : Unit → Except ε α) : Except ε α :=\n match x with\n | Except.ok a => Except.ok a\n | Except.error _ => y ()",
"start": [
60,
1
],
"end": [
63,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT",
"code": "def ExceptT (ε : Type u) (m : Type u → Type v) (α : Type u) : Type v :=\n m (Except ε α)",
"start": [
73,
1
],
"end": [
74,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.mk",
"code": "@[always_inline, inline]\ndef ExceptT.mk {ε : Type u} {m : Type u → Type v} {α : Type u} (x : m (Except ε α)) : ExceptT ε m α := x",
"start": [
76,
1
],
"end": [
77,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.run",
"code": "@[always_inline, inline]\ndef ExceptT.run {ε : Type u} {m : Type u → Type v} {α : Type u} (x : ExceptT ε m α) : m (Except ε α) := x",
"start": [
79,
1
],
"end": [
80,
106
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.pure",
"code": "@[always_inline, inline]\nprotected def pure {α : Type u} (a : α) : ExceptT ε m α :=\n ExceptT.mk <| pure (Except.ok a)",
"start": [
86,
1
],
"end": [
88,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.bindCont",
"code": "@[always_inline, inline]\nprotected def bindCont {α β : Type u} (f : α → ExceptT ε m β) : Except ε α → m (Except ε β)\n | Except.ok a => f a\n | Except.error e => pure (Except.error e)",
"start": [
90,
1
],
"end": [
93,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.bind",
"code": "@[always_inline, inline]\nprotected def bind {α β : Type u} (ma : ExceptT ε m α) (f : α → ExceptT ε m β) : ExceptT ε m β :=\n ExceptT.mk <| ma >>= ExceptT.bindCont f",
"start": [
95,
1
],
"end": [
97,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.map",
"code": "@[always_inline, inline]\nprotected def map {α β : Type u} (f : α → β) (x : ExceptT ε m α) : ExceptT ε m β :=\n ExceptT.mk <| x >>= fun a => match a with\n | (Except.ok a) => pure <| Except.ok (f a)\n | (Except.error e) => pure <| Except.error e",
"start": [
99,
1
],
"end": [
103,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.lift",
"code": "@[always_inline, inline]\nprotected def lift {α : Type u} (t : m α) : ExceptT ε m α :=\n ExceptT.mk <| Except.ok <$> t",
"start": [
105,
1
],
"end": [
107,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.tryCatch",
"code": "@[always_inline, inline]\nprotected def tryCatch {α : Type u} (ma : ExceptT ε m α) (handle : ε → ExceptT ε m α) : ExceptT ε m α :=\n ExceptT.mk <| ma >>= fun res => match res with\n | Except.ok a => pure (Except.ok a)\n | Except.error e => (handle e)",
"start": [
113,
1
],
"end": [
117,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.adapt",
"code": "@[always_inline, inline]\nprotected def adapt {ε' α : Type u} (f : ε → ε') : ExceptT ε m α → ExceptT ε' m α := fun x =>\n ExceptT.mk <| Except.mapError f <$> x",
"start": [
127,
1
],
"end": [
129,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadExcept.orelse'",
"code": "@[always_inline, inline]\ndef orelse' [MonadExcept ε m] {α : Type v} (t₁ t₂ : m α) (useFirstEx := true) : m α :=\n tryCatch t₁ fun e₁ => tryCatch t₂ fun e₂ => throw (if useFirstEx then e₁ else e₂)",
"start": [
153,
1
],
"end": [
157,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "observing",
"code": "@[always_inline, inline]\ndef observing {ε α : Type u} {m : Type u → Type v} [Monad m] [MonadExcept ε m] (x : m α) : m (Except ε α) :=\n tryCatch (do let a ← x; pure (Except.ok a)) (fun ex => pure (Except.error ex))",
"start": [
161,
1
],
"end": [
163,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "liftExcept",
"code": "def liftExcept [MonadExceptOf ε m] [Pure m] : Except ε α → m α\n | Except.ok a => pure a\n | Except.error e => throw e",
"start": [
165,
1
],
"end": [
167,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "MonadFinally",
"code": "class MonadFinally (m : Type u → Type v) where\n \n tryFinally' {α β} : m α → (Option α → m β) → m (α × β)",
"start": [
174,
1
],
"end": [
180,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "tryFinally",
"code": "@[always_inline, inline]\ndef tryFinally {m : Type u → Type v} {α β : Type u} [MonadFinally m] [Functor m] (x : m α) (finalizer : m β) : m α :=\n let y := tryFinally' x (fun _ => finalizer)\n (·.1) <$> y",
"start": [
184,
1
],
"end": [
188,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.finally",
"code": "@[always_inline]\ninstance Id.finally : MonadFinally Id where\n tryFinally' := fun x h =>\n let a := x\n let b := h (some x)\n pure (a, b)",
"start": [
190,
1
],
"end": [
195,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "ExceptT.finally",
"code": "@[always_inline]\ninstance ExceptT.finally {m : Type u → Type v} {ε : Type u} [MonadFinally m] [Monad m] : MonadFinally (ExceptT ε m) where\n tryFinally' := fun x h => ExceptT.mk do\n let r ← tryFinally' x fun e? => match e? with\n | some (.ok a) => h (some a)\n | _ => h none\n match r with\n | (.ok a, .ok b) => pure (.ok (a, b))\n | (_, .error e) => pure (.error e) | (.error e, _) => pure (.error e)",
"start": [
197,
1
],
"end": [
206,
46
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/List/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Cast.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean"
] | [
{
"full_name": "Int",
"code": "inductive Int : Type where\n \n | ofNat : Nat → Int\n \n | negSucc : Nat → Int",
"start": [
26,
1
],
"end": [
45,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "instOfNat",
"code": "instance instOfNat : OfNat Int n where\n ofNat := Int.ofNat n",
"start": [
52,
1
],
"end": [
53,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.default_eq_zero",
"code": "@[simp] theorem default_eq_zero : default = (0 : Int)",
"start": [
65,
1
],
"end": [
65,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_ne_one",
"code": "protected theorem zero_ne_one : (0 : Int) ≠ 1",
"start": [
67,
1
],
"end": [
67,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_eq_coe",
"code": "@[simp] theorem ofNat_eq_coe : Int.ofNat n = Nat.cast n",
"start": [
71,
1
],
"end": [
71,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_zero",
"code": "@[simp] theorem ofNat_zero : ((0 : Nat) : Int) = 0",
"start": [
73,
1
],
"end": [
73,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_one",
"code": "@[simp] theorem ofNat_one : ((1 : Nat) : Int) = 1",
"start": [
75,
1
],
"end": [
75,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_two",
"code": "theorem ofNat_two : ((2 : Nat) : Int) = 2",
"start": [
77,
1
],
"end": [
77,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat",
"code": "def negOfNat : Nat → Int\n | 0 => 0\n | succ m => negSucc m",
"start": [
79,
1
],
"end": [
82,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg",
"code": "@[extern \"lean_int_neg\"]\nprotected def neg (n : @& Int) : Int :=\n match n with\n | ofNat n => negOfNat n\n | negSucc n => succ n",
"start": [
85,
1
],
"end": [
92,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.instNegInt",
"code": "@[default_instance mid]\ninstance instNegInt : Neg Int where\n neg := Int.neg",
"start": [
102,
1
],
"end": [
104,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat",
"code": "def subNatNat (m n : Nat) : Int :=\n match (n - m : Nat) with\n | 0 => ofNat (m - n) | (succ k) => negSucc k",
"start": [
106,
1
],
"end": [
110,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add",
"code": "@[extern \"lean_int_add\"]\nprotected def add (m n : @& Int) : Int :=\n match m, n with\n | ofNat m, ofNat n => ofNat (m + n)\n | ofNat m, -[n +1] => subNatNat m (succ n)\n | -[m +1], ofNat n => subNatNat n (succ m)\n | -[m +1], -[n +1] => negSucc (succ (m + n))",
"start": [
113,
1
],
"end": [
127,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul",
"code": "@[extern \"lean_int_mul\"]\nprotected def mul (m n : @& Int) : Int :=\n match m, n with\n | ofNat m, ofNat n => ofNat (m * n)\n | ofNat m, -[n +1] => negOfNat (m * succ n)\n | -[m +1], ofNat n => negOfNat (succ m * n)\n | -[m +1], -[n +1] => ofNat (succ m * succ n)",
"start": [
133,
1
],
"end": [
148,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub",
"code": "@[extern \"lean_int_sub\"]\nprotected def sub (m n : @& Int) : Int := m + (- n)",
"start": [
153,
1
],
"end": [
163,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.NonNeg",
"code": "inductive NonNeg : Int → Prop where\n \n | mk (n : Nat) : NonNeg (ofNat n)",
"start": [
168,
1
],
"end": [
171,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le",
"code": "protected def le (a b : Int) : Prop := NonNeg (b - a)",
"start": [
173,
1
],
"end": [
174,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.instLEInt",
"code": "instance instLEInt : LE Int where\n le := Int.le",
"start": [
176,
1
],
"end": [
177,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt",
"code": "protected def lt (a b : Int) : Prop := (a + 1) ≤ b",
"start": [
179,
1
],
"end": [
180,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.instLTInt",
"code": "instance instLTInt : LT Int where\n lt := Int.lt",
"start": [
182,
1
],
"end": [
183,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.decEq",
"code": "@[extern \"lean_int_dec_eq\"]\nprotected def decEq (a b : @& Int) : Decidable (a = b) :=\n match a, b with\n | ofNat a, ofNat b => match decEq a b with\n | isTrue h => isTrue <| h ▸ rfl\n | isFalse h => isFalse <| fun h' => Int.noConfusion h' (fun h' => absurd h' h)\n | ofNat _, -[_ +1] => isFalse <| fun h => Int.noConfusion h\n | -[_ +1], ofNat _ => isFalse <| fun h => Int.noConfusion h\n | -[a +1], -[b +1] => match decEq a b with\n | isTrue h => isTrue <| h ▸ rfl\n | isFalse h => isFalse <| fun h' => Int.noConfusion h' (fun h' => absurd h' h)",
"start": [
186,
1
],
"end": [
205,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.decNonneg",
"code": "@[extern \"lean_int_dec_nonneg\"]\nprivate def decNonneg (m : @& Int) : Decidable (NonNeg m) :=\n match m with\n | ofNat m => isTrue <| NonNeg.mk m\n | -[_ +1] => isFalse <| fun h => nomatch h",
"start": [
210,
1
],
"end": [
223,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.decLe",
"code": "@[extern \"lean_int_dec_le\"]\ninstance decLe (a b : @& Int) : Decidable (a ≤ b) :=\n decNonneg _",
"start": [
225,
1
],
"end": [
236,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.decLt",
"code": "@[extern \"lean_int_dec_lt\"]\ninstance decLt (a b : @& Int) : Decidable (a < b) :=\n decNonneg _",
"start": [
238,
1
],
"end": [
249,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs",
"code": "@[extern \"lean_nat_abs\"]\ndef natAbs (m : @& Int) : Nat :=\n match m with\n | ofNat m => m\n | -[m +1] => m.succ",
"start": [
252,
1
],
"end": [
265,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign",
"code": "def sign : Int → Int\n | Int.ofNat (succ _) => 1\n | Int.ofNat 0 => 0\n | -[_+1] => -1",
"start": [
269,
1
],
"end": [
276,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat",
"code": "def toNat : Int → Nat\n | ofNat n => n\n | negSucc _ => 0",
"start": [
280,
1
],
"end": [
291,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat'",
"code": "def toNat' : Int → Option Nat\n | (n : Nat) => some n\n | -[_+1] => none",
"start": [
293,
1
],
"end": [
299,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.pow",
"code": "protected def pow (m : Int) : Nat → Int\n | 0 => 1\n | succ n => Int.pow m n * m",
"start": [
312,
1
],
"end": [
323,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "IntCast",
"code": "class IntCast (R : Type u) where\n \n protected intCast : Int → R",
"start": [
338,
1
],
"end": [
344,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.cast",
"code": "@[coe, reducible, match_pattern] protected def Int.cast {R : Type u} [IntCast R] : Int → R :=\n IntCast.intCast",
"start": [
348,
1
],
"end": [
354,
18
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/String/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Char/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/List/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean"
] | [
{
"full_name": "List.asString",
"code": "def List.asString (s : List Char) : String :=\n ⟨s⟩",
"start": [
13,
1
],
"end": [
14,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "String.decLt",
"code": "@[extern \"lean_string_dec_lt\"]\ninstance decLt (s₁ s₂ : @& String) : Decidable (s₁ < s₂) :=\n List.hasDecidableLt s₁.data s₂.data",
"start": [
24,
1
],
"end": [
26,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "String.le",
"code": "@[reducible] protected def le (a b : String) : Prop := ¬ b < a",
"start": [
28,
1
],
"end": [
28,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "String.decLE",
"code": "instance decLE (s₁ s₂ : String) : Decidable (s₁ ≤ s₂) :=\n inferInstanceAs (Decidable (Not _))",
"start": [
33,
1
],
"end": [
34,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length",
"code": "@[extern \"lean_string_length\"]\ndef length : (@& String) → Nat\n | ⟨s⟩ => s.length",
"start": [
36,
1
],
"end": [
46,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "String.push",
"code": "@[extern \"lean_string_push\"]\ndef push : String → Char → String\n | ⟨s⟩, c => ⟨s ++ [c]⟩",
"start": [
48,
1
],
"end": [
58,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "String.append",
"code": "@[extern \"lean_string_append\"]\ndef append : String → (@& String) → String\n | ⟨a⟩, ⟨b⟩ => ⟨a ++ b⟩",
"start": [
60,
1
],
"end": [
70,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toList",
"code": "def toList (s : String) : List Char :=\n s.data",
"start": [
72,
1
],
"end": [
82,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.isValid",
"code": "@[extern \"lean_string_is_valid_pos\"]\ndef Pos.isValid (s : @&String) (p : @& Pos) : Bool :=\n go s.data 0\nwhere\n go : List Char → Pos → Bool\n | [], i => i = p\n | c::cs, i => if i = p then true else go cs (i + c)",
"start": [
84,
1
],
"end": [
92,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8GetAux",
"code": "def utf8GetAux : List Char → Pos → Pos → Char\n | [], _, _ => default\n | c::cs, i, p => if i = p then c else utf8GetAux cs (i + c) p",
"start": [
94,
1
],
"end": [
96,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get",
"code": "@[extern \"lean_string_utf8_get\"]\ndef get (s : @& String) (p : @& Pos) : Char :=\n match s with\n | ⟨s⟩ => utf8GetAux s 0 p",
"start": [
98,
1
],
"end": [
114,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8GetAux?",
"code": "def utf8GetAux? : List Char → Pos → Pos → Option Char\n | [], _, _ => none\n | c::cs, i, p => if i = p then c else utf8GetAux? cs (i + c) p",
"start": [
116,
1
],
"end": [
118,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get?",
"code": "@[extern \"lean_string_utf8_get_opt\"]\ndef get? : (@& String) → (@& Pos) → Option Char\n | ⟨s⟩, p => utf8GetAux? s 0 p",
"start": [
120,
1
],
"end": [
132,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get!",
"code": "@[extern \"lean_string_utf8_get_bang\"]\ndef get! (s : @& String) (p : @& Pos) : Char :=\n match s with\n | ⟨s⟩ => utf8GetAux s 0 p",
"start": [
134,
1
],
"end": [
148,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8SetAux",
"code": "def utf8SetAux (c' : Char) : List Char → Pos → Pos → List Char\n | [], _, _ => []\n | c::cs, i, p =>\n if i = p then (c'::cs) else c::(utf8SetAux c' cs (i + c) p)",
"start": [
150,
1
],
"end": [
153,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "String.set",
"code": "@[extern \"lean_string_utf8_set\"]\ndef set : String → (@& Pos) → Char → String\n | ⟨s⟩, i, c => ⟨utf8SetAux c s 0 i⟩",
"start": [
155,
1
],
"end": [
172,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "String.modify",
"code": "def modify (s : String) (i : Pos) (f : Char → Char) : String :=\n s.set i <| f <| s.get i",
"start": [
174,
1
],
"end": [
183,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.next",
"code": "@[extern \"lean_string_utf8_next\"]\ndef next (s : @& String) (p : @& Pos) : Pos :=\n let c := get s p\n p + c",
"start": [
185,
1
],
"end": [
201,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8PrevAux",
"code": "def utf8PrevAux : List Char → Pos → Pos → Pos\n | [], _, _ => 0\n | c::cs, i, p =>\n let i' := i + c\n if i' = p then i else utf8PrevAux cs i' p",
"start": [
203,
1
],
"end": [
207,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "String.prev",
"code": "@[extern \"lean_string_utf8_prev\"]\ndef prev : (@& String) → (@& Pos) → Pos\n | ⟨s⟩, p => if p = 0 then 0 else utf8PrevAux s 0 p",
"start": [
209,
1
],
"end": [
221,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "String.front",
"code": "def front (s : String) : Char :=\n get s 0",
"start": [
223,
1
],
"end": [
231,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "String.back",
"code": "def back (s : String) : Char :=\n get s (prev s s.endPos)",
"start": [
233,
1
],
"end": [
241,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.atEnd",
"code": "@[extern \"lean_string_utf8_at_end\"]\ndef atEnd : (@& String) → (@& Pos) → Bool\n | s, p => p.byteIdx ≥ utf8ByteSize s",
"start": [
243,
1
],
"end": [
257,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get'",
"code": "@[extern \"lean_string_utf8_get_fast\"]\ndef get' (s : @& String) (p : @& Pos) (h : ¬ s.atEnd p) : Char :=\n match s with\n | ⟨s⟩ => utf8GetAux s 0 p",
"start": [
259,
1
],
"end": [
284,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.next'",
"code": "@[extern \"lean_string_utf8_next_fast\"]\ndef next' (s : @& String) (p : @& Pos) (h : ¬ s.atEnd p) : Pos :=\n let c := get s p\n p + c",
"start": [
286,
1
],
"end": [
306,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.utf8Size_pos",
"code": "theorem _root_.Char.utf8Size_pos (c : Char) : 0 < c.utf8Size",
"start": [
308,
1
],
"end": [
309,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.utf8Size_le_four",
"code": "theorem _root_.Char.utf8Size_le_four (c : Char) : c.utf8Size ≤ 4",
"start": [
311,
1
],
"end": [
312,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "String.one_le_csize",
"code": "@[deprecated Char.utf8Size_pos (since := \"2026-06-04\")] abbrev one_le_csize := Char.utf8Size_pos",
"start": [
314,
1
],
"end": [
314,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "String.pos_lt_eq",
"code": "@[simp] theorem pos_lt_eq (p₁ p₂ : Pos) : (p₁ < p₂) = (p₁.1 < p₂.1)",
"start": [
316,
1
],
"end": [
316,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "String.pos_add_char",
"code": "@[simp] theorem pos_add_char (p : Pos) (c : Char) : (p + c).byteIdx = p.byteIdx + c.utf8Size",
"start": [
318,
1
],
"end": [
318,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "String.lt_next",
"code": "theorem lt_next (s : String) (i : Pos) : i.1 < (s.next i).1",
"start": [
320,
1
],
"end": [
321,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8PrevAux_lt_of_pos",
"code": "theorem utf8PrevAux_lt_of_pos : ∀ (cs : List Char) (i p : Pos), p ≠ 0 →\n (utf8PrevAux cs i p).1 < p.1",
"start": [
323,
1
],
"end": [
332,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "String.prev_lt_of_pos",
"code": "theorem prev_lt_of_pos (s : String) (i : Pos) (h : i ≠ 0) : (s.prev i).1 < i.1",
"start": [
334,
1
],
"end": [
336,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "String.posOfAux",
"code": "def posOfAux (s : String) (c : Char) (stopPos : Pos) (pos : Pos) : Pos :=\n if h : pos < stopPos then\n if s.get pos == c then pos\n else\n have := Nat.sub_lt_sub_left h (lt_next s pos)\n posOfAux s c stopPos (s.next pos)\n else pos\ntermination_by stopPos.1 - pos.1",
"start": [
338,
1
],
"end": [
345,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.posOf",
"code": "@[inline] def posOf (s : String) (c : Char) : Pos :=\n posOfAux s c s.endPos 0",
"start": [
347,
1
],
"end": [
357,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.revPosOfAux",
"code": "def revPosOfAux (s : String) (c : Char) (pos : Pos) : Option Pos :=\n if h : pos = 0 then none\n else\n have := prev_lt_of_pos s pos h\n let pos := s.prev pos\n if s.get pos == c then some pos\n else revPosOfAux s c pos\ntermination_by pos.1",
"start": [
359,
1
],
"end": [
366,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "String.revPosOf",
"code": "def revPosOf (s : String) (c : Char) : Option Pos :=\n revPosOfAux s c s.endPos",
"start": [
368,
1
],
"end": [
378,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "String.findAux",
"code": "def findAux (s : String) (p : Char → Bool) (stopPos : Pos) (pos : Pos) : Pos :=\n if h : pos < stopPos then\n if p (s.get pos) then pos\n else\n have := Nat.sub_lt_sub_left h (lt_next s pos)\n findAux s p stopPos (s.next pos)\n else pos\ntermination_by stopPos.1 - pos.1",
"start": [
380,
1
],
"end": [
387,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.find",
"code": "@[inline] def find (s : String) (p : Char → Bool) : Pos :=\n findAux s p s.endPos 0",
"start": [
389,
1
],
"end": [
390,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "String.revFindAux",
"code": "def revFindAux (s : String) (p : Char → Bool) (pos : Pos) : Option Pos :=\n if h : pos = 0 then none\n else\n have := prev_lt_of_pos s pos h\n let pos := s.prev pos\n if p (s.get pos) then some pos\n else revFindAux s p pos\ntermination_by pos.1",
"start": [
392,
1
],
"end": [
399,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "String.revFind",
"code": "def revFind (s : String) (p : Char → Bool) : Option Pos :=\n revFindAux s p s.endPos",
"start": [
401,
1
],
"end": [
402,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.min",
"code": "abbrev Pos.min (p₁ p₂ : Pos) : Pos :=\n { byteIdx := p₁.byteIdx.min p₂.byteIdx }",
"start": [
404,
1
],
"end": [
405,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.firstDiffPos",
"code": "def firstDiffPos (a b : String) : Pos :=\n let stopPos := a.endPos.min b.endPos\n let rec loop (i : Pos) : Pos :=\n if h : i < stopPos then\n if a.get i != b.get i then i\n else\n have := Nat.sub_lt_sub_left h (lt_next a i)\n loop (a.next i)\n else i\n termination_by stopPos.1 - i.1\n loop 0",
"start": [
407,
1
],
"end": [
418,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "String.extract",
"code": "@[extern \"lean_string_utf8_extract\"]\ndef extract : (@& String) → (@& Pos) → (@& Pos) → String\n | ⟨s⟩, b, e => if b.byteIdx ≥ e.byteIdx then \"\" else ⟨go₁ s 0 b e⟩\nwhere\n go₁ : List Char → Pos → Pos → Pos → List Char\n | [], _, _, _ => []\n | s@(c::cs), i, b, e => if i = b then go₂ s i e else go₁ cs (i + c) b e\n\n go₂ : List Char → Pos → Pos → List Char\n | [], _, _ => []\n | c::cs, i, e => if i = e then [] else c :: go₂ cs (i + c) e",
"start": [
420,
1
],
"end": [
430,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "String.splitAux",
"code": "@[specialize] def splitAux (s : String) (p : Char → Bool) (b : Pos) (i : Pos) (r : List String) : List String :=\n if h : s.atEnd i then\n let r := (s.extract b i)::r\n r.reverse\n else\n have := Nat.sub_lt_sub_left (Nat.gt_of_not_le (mt decide_eq_true h)) (lt_next s _)\n if p (s.get i) then\n let i' := s.next i\n splitAux s p i' i' (s.extract b i :: r)\n else\n splitAux s p b (s.next i) r\ntermination_by s.endPos.1 - i.1",
"start": [
433,
1
],
"end": [
444,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.split",
"code": "@[specialize] def split (s : String) (p : Char → Bool) : List String :=\n splitAux s p 0 0 []",
"start": [
446,
1
],
"end": [
447,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "String.splitOnAux",
"code": "def splitOnAux (s sep : String) (b : Pos) (i : Pos) (j : Pos) (r : List String) : List String :=\n if s.atEnd i then\n let r := (s.extract b i)::r\n r.reverse\n else\n if s.get i == sep.get j then\n let i := s.next i\n let j := sep.next j\n if sep.atEnd j then\n splitOnAux s sep i i 0 (s.extract b (i - j)::r)\n else\n splitOnAux s sep b i j r\n else\n splitOnAux s sep b (s.next (i - j)) 0 r\ntermination_by (s.endPos.1 - (i - j).1, sep.endPos.1 - j.1)\ndecreasing_by\n all_goals simp_wf\n focus\n rename_i h _ _\n left; exact Nat.sub_lt_sub_left\n (Nat.lt_of_le_of_lt (Nat.sub_le ..) (Nat.gt_of_not_le (mt decide_eq_true h)))\n (Nat.lt_of_le_of_lt (Nat.sub_le ..) (lt_next s _))\n focus\n rename_i i₀ j₀ _ eq h'\n rw [show (s.next i₀ - sep.next j₀).1 = (i₀ - j₀).1 by\n show (_ + Char.utf8Size _) - (_ + Char.utf8Size _) = _\n rw [(beq_iff_eq ..).1 eq, Nat.add_sub_add_right]; rfl]\n right; exact Nat.sub_lt_sub_left\n (Nat.lt_of_le_of_lt (Nat.le_add_right ..) (Nat.gt_of_not_le (mt decide_eq_true h')))\n (lt_next sep _)\n focus\n rename_i h _\n left; exact Nat.sub_lt_sub_left\n (Nat.lt_of_le_of_lt (Nat.sub_le ..) (Nat.gt_of_not_le (mt decide_eq_true h)))\n (lt_next s _)",
"start": [
449,
1
],
"end": [
493,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "String.splitOn",
"code": "def splitOn (s : String) (sep : String := \" \") : List String :=\n if sep == \"\" then [s] else splitOnAux s sep 0 0 0 []",
"start": [
495,
1
],
"end": [
509,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "String.str",
"code": "@[deprecated push (since := \"2024-04-06\")]\ndef str : String → Char → String := push",
"start": [
515,
1
],
"end": [
516,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "String.pushn",
"code": "def pushn (s : String) (c : Char) (n : Nat) : String :=\n n.repeat (fun s => s.push c) s",
"start": [
518,
1
],
"end": [
519,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.isEmpty",
"code": "def isEmpty (s : String) : Bool :=\n s.endPos == 0",
"start": [
521,
1
],
"end": [
522,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "String.join",
"code": "def join (l : List String) : String :=\n l.foldl (fun r s => r ++ s) \"\"",
"start": [
524,
1
],
"end": [
525,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.singleton",
"code": "def singleton (c : Char) : String :=\n \"\".push c",
"start": [
527,
1
],
"end": [
528,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "String.intercalate",
"code": "def intercalate (s : String) : List String → String\n | [] => \"\"\n | a :: as => go a s as\nwhere go (acc : String) (s : String) : List String → String\n | a :: as => go (acc ++ s ++ a) s as\n | [] => acc",
"start": [
530,
1
],
"end": [
535,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator",
"code": "structure Iterator where\n \n s : String\n \n i : Pos\n deriving DecidableEq",
"start": [
537,
1
],
"end": [
561,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "String.mkIterator",
"code": "def mkIterator (s : String) : Iterator :=\n ⟨s, 0⟩",
"start": [
563,
1
],
"end": [
565,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "String.iter",
"code": "@[inherit_doc mkIterator]\nabbrev iter := mkIterator",
"start": [
567,
1
],
"end": [
568,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.sizeOf_eq",
"code": "theorem Iterator.sizeOf_eq (i : String.Iterator) : sizeOf i = i.1.utf8ByteSize - i.2.byteIdx",
"start": [
574,
1
],
"end": [
575,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.toString",
"code": "@[inherit_doc Iterator.s]\ndef toString := Iterator.s",
"start": [
578,
1
],
"end": [
579,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.remainingBytes",
"code": "def remainingBytes : Iterator → Nat\n | ⟨s, i⟩ => s.endPos.byteIdx - i.byteIdx",
"start": [
581,
1
],
"end": [
583,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.pos",
"code": "@[inherit_doc Iterator.i]\ndef pos := Iterator.i",
"start": [
585,
1
],
"end": [
586,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.curr",
"code": "def curr : Iterator → Char\n | ⟨s, i⟩ => get s i",
"start": [
588,
1
],
"end": [
592,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.next",
"code": "def next : Iterator → Iterator\n | ⟨s, i⟩ => ⟨s, s.next i⟩",
"start": [
594,
1
],
"end": [
599,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.prev",
"code": "def prev : Iterator → Iterator\n | ⟨s, i⟩ => ⟨s, s.prev i⟩",
"start": [
601,
1
],
"end": [
605,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.atEnd",
"code": "def atEnd : Iterator → Bool\n | ⟨s, i⟩ => i.byteIdx ≥ s.endPos.byteIdx",
"start": [
607,
1
],
"end": [
609,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.hasNext",
"code": "def hasNext : Iterator → Bool\n | ⟨s, i⟩ => i.byteIdx < s.endPos.byteIdx",
"start": [
611,
1
],
"end": [
613,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.hasPrev",
"code": "def hasPrev : Iterator → Bool\n | ⟨_, i⟩ => i.byteIdx > 0",
"start": [
615,
1
],
"end": [
617,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.setCurr",
"code": "def setCurr : Iterator → Char → Iterator\n | ⟨s, i⟩, c => ⟨s.set i c, i⟩",
"start": [
619,
1
],
"end": [
625,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.toEnd",
"code": "def toEnd : Iterator → Iterator\n | ⟨s, _⟩ => ⟨s, s.endPos⟩",
"start": [
627,
1
],
"end": [
631,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.extract",
"code": "def extract : Iterator → Iterator → String\n | ⟨s₁, b⟩, ⟨s₂, e⟩ =>\n if s₁ ≠ s₂ || b > e then \"\"\n else s₁.extract b e",
"start": [
633,
1
],
"end": [
640,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.forward",
"code": "def forward : Iterator → Nat → Iterator\n | it, 0 => it\n | it, n+1 => forward it.next n",
"start": [
642,
1
],
"end": [
648,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.remainingToString",
"code": "def remainingToString : Iterator → String\n | ⟨s, i⟩ => s.extract i s.endPos",
"start": [
650,
1
],
"end": [
652,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.nextn",
"code": "@[inherit_doc forward]\ndef nextn : Iterator → Nat → Iterator\n | it, 0 => it\n | it, i+1 => nextn it.next i",
"start": [
654,
1
],
"end": [
657,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.prevn",
"code": "def prevn : Iterator → Nat → Iterator\n | it, 0 => it\n | it, i+1 => prevn it.prev i",
"start": [
659,
1
],
"end": [
664,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.offsetOfPosAux",
"code": "def offsetOfPosAux (s : String) (pos : Pos) (i : Pos) (offset : Nat) : Nat :=\n if i >= pos then offset\n else if h : s.atEnd i then\n offset\n else\n have := Nat.sub_lt_sub_left (Nat.gt_of_not_le (mt decide_eq_true h)) (lt_next s _)\n offsetOfPosAux s pos (s.next i) (offset+1)\ntermination_by s.endPos.1 - i.1",
"start": [
667,
1
],
"end": [
674,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.offsetOfPos",
"code": "def offsetOfPos (s : String) (pos : Pos) : Nat :=\n offsetOfPosAux s pos 0 0",
"start": [
676,
1
],
"end": [
677,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "String.foldlAux",
"code": "@[specialize] def foldlAux {α : Type u} (f : α → Char → α) (s : String) (stopPos : Pos) (i : Pos) (a : α) : α :=\n if h : i < stopPos then\n have := Nat.sub_lt_sub_left h (lt_next s i)\n foldlAux f s stopPos (s.next i) (f a (s.get i))\n else a\ntermination_by stopPos.1 - i.1",
"start": [
679,
1
],
"end": [
684,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.foldl",
"code": "@[inline] def foldl {α : Type u} (f : α → Char → α) (init : α) (s : String) : α :=\n foldlAux f s s.endPos 0 init",
"start": [
686,
1
],
"end": [
687,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.foldrAux",
"code": "@[specialize] def foldrAux {α : Type u} (f : Char → α → α) (a : α) (s : String) (i begPos : Pos) : α :=\n if h : begPos < i then\n have := String.prev_lt_of_pos s i <| mt (congrArg String.Pos.byteIdx) <|\n Ne.symm <| Nat.ne_of_lt <| Nat.lt_of_le_of_lt (Nat.zero_le _) h\n let i := s.prev i\n let a := f (s.get i) a\n foldrAux f a s i begPos\n else a\ntermination_by i.1",
"start": [
689,
1
],
"end": [
697,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "String.foldr",
"code": "@[inline] def foldr {α : Type u} (f : Char → α → α) (init : α) (s : String) : α :=\n foldrAux f init s s.endPos 0",
"start": [
699,
1
],
"end": [
700,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.anyAux",
"code": "@[specialize] def anyAux (s : String) (stopPos : Pos) (p : Char → Bool) (i : Pos) : Bool :=\n if h : i < stopPos then\n if p (s.get i) then true\n else\n have := Nat.sub_lt_sub_left h (lt_next s i)\n anyAux s stopPos p (s.next i)\n else false\ntermination_by stopPos.1 - i.1",
"start": [
702,
1
],
"end": [
709,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "String.any",
"code": "@[inline] def any (s : String) (p : Char → Bool) : Bool :=\n anyAux s s.endPos p 0",
"start": [
711,
1
],
"end": [
712,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "String.all",
"code": "@[inline] def all (s : String) (p : Char → Bool) : Bool :=\n !s.any (fun c => !p c)",
"start": [
714,
1
],
"end": [
715,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "String.contains",
"code": "def contains (s : String) (c : Char) : Bool :=\ns.any (fun a => a == c)",
"start": [
717,
1
],
"end": [
718,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8SetAux_of_gt",
"code": "theorem utf8SetAux_of_gt (c' : Char) : ∀ (cs : List Char) {i p : Pos}, i > p → utf8SetAux c' cs i p = cs",
"start": [
720,
1
],
"end": [
724,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "String.set_next_add",
"code": "theorem set_next_add (s : String) (i : Pos) (c : Char) (b₁ b₂)\n (h : (s.next i).1 + b₁ = s.endPos.1 + b₂) :\n ((s.set i c).next i).1 + b₁ = (s.set i c).endPos.1 + b₂",
"start": [
726,
1
],
"end": [
744,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "String.mapAux_lemma",
"code": "theorem mapAux_lemma (s : String) (i : Pos) (c : Char) (h : ¬s.atEnd i) :\n (s.set i c).endPos.1 - ((s.set i c).next i).1 < s.endPos.1 - i.1",
"start": [
746,
1
],
"end": [
759,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "String.mapAux",
"code": "@[specialize] def mapAux (f : Char → Char) (i : Pos) (s : String) : String :=\n if h : s.atEnd i then s\n else\n let c := f (s.get i)\n have := mapAux_lemma s i c h\n let s := s.set i c\n mapAux f (s.next i) s\ntermination_by s.endPos.1 - i.1",
"start": [
761,
1
],
"end": [
768,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.map",
"code": "@[inline] def map (f : Char → Char) (s : String) : String :=\n mapAux f 0 s",
"start": [
770,
1
],
"end": [
771,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "String.isNat",
"code": "def isNat (s : String) : Bool :=\n !s.isEmpty && s.all (·.isDigit)",
"start": [
773,
1
],
"end": [
774,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toNat?",
"code": "def toNat? (s : String) : Option Nat :=\n if s.isNat then\n some <| s.foldl (fun n c => n*10 + (c.toNat - '0'.toNat)) 0\n else\n none",
"start": [
776,
1
],
"end": [
780,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "String.substrEq",
"code": "def substrEq (s1 : String) (off1 : String.Pos) (s2 : String) (off2 : String.Pos) (sz : Nat) : Bool :=\n off1.byteIdx + sz ≤ s1.endPos.byteIdx && off2.byteIdx + sz ≤ s2.endPos.byteIdx && loop off1 off2 { byteIdx := off1.byteIdx + sz }\nwhere\n loop (off1 off2 stop1 : Pos) :=\n if _h : off1.byteIdx < stop1.byteIdx then\n let c₁ := s1.get off1\n let c₂ := s2.get off2\n c₁ == c₂ && loop (off1 + c₁) (off2 + c₂) stop1\n else true\n termination_by stop1.1 - off1.1\n decreasing_by\n have := Nat.sub_lt_sub_left _h (Nat.add_lt_add_left c₁.utf8Size_pos off1.1)\n decreasing_tactic",
"start": [
782,
1
],
"end": [
797,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "String.isPrefixOf",
"code": "def isPrefixOf (p : String) (s : String) : Bool :=\n substrEq p 0 s 0 p.endPos.byteIdx",
"start": [
799,
1
],
"end": [
801,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "String.replace",
"code": "def replace (s pattern replacement : String) : String :=\n if h : pattern.endPos.1 = 0 then s\n else\n have hPatt := Nat.zero_lt_of_ne_zero h\n let rec loop (acc : String) (accStop pos : String.Pos) :=\n if h : pos.byteIdx + pattern.endPos.byteIdx > s.endPos.byteIdx then\n acc ++ s.extract accStop s.endPos\n else\n have := Nat.lt_of_lt_of_le (Nat.add_lt_add_left hPatt _) (Nat.ge_of_not_lt h)\n if s.substrEq pos pattern 0 pattern.endPos.byteIdx then\n have := Nat.sub_lt_sub_left this (Nat.add_lt_add_left hPatt _)\n loop (acc ++ s.extract accStop pos ++ replacement) (pos + pattern) (pos + pattern)\n else\n have := Nat.sub_lt_sub_left this (lt_next s pos)\n loop acc accStop (s.next pos)\n termination_by s.endPos.1 - pos.1\n loop \"\" 0 0",
"start": [
803,
1
],
"end": [
820,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "String.findLineStart",
"code": "def findLineStart (s : String) (pos : String.Pos) : String.Pos :=\n match s.revFindAux (· = '\\n') pos with\n | none => 0\n | some n => ⟨n.byteIdx + 1⟩",
"start": [
822,
1
],
"end": [
826,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.isEmpty",
"code": "@[inline] def isEmpty (ss : Substring) : Bool :=\n ss.bsize == 0",
"start": [
832,
1
],
"end": [
833,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.toString",
"code": "@[inline] def toString : Substring → String\n | ⟨s, b, e⟩ => s.extract b e",
"start": [
835,
1
],
"end": [
836,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.toIterator",
"code": "@[inline] def toIterator : Substring → String.Iterator\n | ⟨s, b, _⟩ => ⟨s, b⟩",
"start": [
838,
1
],
"end": [
839,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.get",
"code": "@[inline] def get : Substring → String.Pos → Char\n | ⟨s, b, _⟩, p => s.get (b+p)",
"start": [
841,
1
],
"end": [
843,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.next",
"code": "@[inline] def next : Substring → String.Pos → String.Pos\n | ⟨s, b, e⟩, p =>\n let absP := b+p\n if absP = e then p else { byteIdx := (s.next absP).byteIdx - b.byteIdx }",
"start": [
845,
1
],
"end": [
850,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.lt_next",
"code": "theorem lt_next (s : Substring) (i : String.Pos) (h : i.1 < s.bsize) :\n i.1 < (s.next i).1",
"start": [
852,
1
],
"end": [
859,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.prev",
"code": "@[inline] def prev : Substring → String.Pos → String.Pos\n | ⟨s, b, _⟩, p =>\n let absP := b+p\n if absP = b then p else { byteIdx := (s.prev absP).byteIdx - b.byteIdx }",
"start": [
861,
1
],
"end": [
866,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.nextn",
"code": "def nextn : Substring → Nat → String.Pos → String.Pos\n | _, 0, p => p\n | ss, i+1, p => ss.nextn i (ss.next p)",
"start": [
868,
1
],
"end": [
870,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.prevn",
"code": "def prevn : Substring → Nat → String.Pos → String.Pos\n | _, 0, p => p\n | ss, i+1, p => ss.prevn i (ss.prev p)",
"start": [
872,
1
],
"end": [
874,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.front",
"code": "@[inline] def front (s : Substring) : Char :=\n s.get 0",
"start": [
876,
1
],
"end": [
877,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.posOf",
"code": "@[inline] def posOf (s : Substring) (c : Char) : String.Pos :=\n match s with\n | ⟨s, b, e⟩ => { byteIdx := (String.posOfAux s c e b).byteIdx - b.byteIdx }",
"start": [
879,
1
],
"end": [
883,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.drop",
"code": "@[inline] def drop : Substring → Nat → Substring\n | ss@⟨s, b, e⟩, n => ⟨s, b + ss.nextn n 0, e⟩",
"start": [
885,
1
],
"end": [
886,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.dropRight",
"code": "@[inline] def dropRight : Substring → Nat → Substring\n | ss@⟨s, b, _⟩, n => ⟨s, b, b + ss.prevn n ⟨ss.bsize⟩⟩",
"start": [
888,
1
],
"end": [
889,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.take",
"code": "@[inline] def take : Substring → Nat → Substring\n | ss@⟨s, b, _⟩, n => ⟨s, b, b + ss.nextn n 0⟩",
"start": [
891,
1
],
"end": [
892,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.takeRight",
"code": "@[inline] def takeRight : Substring → Nat → Substring\n | ss@⟨s, b, e⟩, n => ⟨s, b + ss.prevn n ⟨ss.bsize⟩, e⟩",
"start": [
894,
1
],
"end": [
895,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.atEnd",
"code": "@[inline] def atEnd : Substring → String.Pos → Bool\n | ⟨_, b, e⟩, p => b + p == e",
"start": [
897,
1
],
"end": [
898,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.extract",
"code": "@[inline] def extract : Substring → String.Pos → String.Pos → Substring\n | ⟨s, b, e⟩, b', e' => if b' ≥ e' then ⟨\"\", 0, 0⟩ else ⟨s, e.min (b+b'), e.min (b+e')⟩",
"start": [
900,
1
],
"end": [
901,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.splitOn",
"code": "def splitOn (s : Substring) (sep : String := \" \") : List Substring :=\n if sep == \"\" then\n [s]\n else\n let rec loop (b i j : String.Pos) (r : List Substring) : List Substring :=\n if h : i.byteIdx < s.bsize then\n have := Nat.sub_lt_sub_left h (lt_next s i h)\n if s.get i == sep.get j then\n let i := s.next i\n let j := sep.next j\n if sep.atEnd j then\n loop i i 0 (s.extract b (i-j) :: r)\n else\n loop b i j r\n else\n loop b (s.next i) 0 r\n else\n let r := if sep.atEnd j then\n \"\".toSubstring :: s.extract b (i-j) :: r\n else\n s.extract b i :: r\n r.reverse\n termination_by s.bsize - i.1\n loop 0 0 0 []",
"start": [
903,
1
],
"end": [
926,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.foldl",
"code": "@[inline] def foldl {α : Type u} (f : α → Char → α) (init : α) (s : Substring) : α :=\n match s with\n | ⟨s, b, e⟩ => String.foldlAux f s e b init",
"start": [
928,
1
],
"end": [
930,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.foldr",
"code": "@[inline] def foldr {α : Type u} (f : Char → α → α) (init : α) (s : Substring) : α :=\n match s with\n | ⟨s, b, e⟩ => String.foldrAux f init s e b",
"start": [
932,
1
],
"end": [
934,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.any",
"code": "@[inline] def any (s : Substring) (p : Char → Bool) : Bool :=\n match s with\n | ⟨s, b, e⟩ => String.anyAux s e p b",
"start": [
936,
1
],
"end": [
938,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.all",
"code": "@[inline] def all (s : Substring) (p : Char → Bool) : Bool :=\n !s.any (fun c => !p c)",
"start": [
940,
1
],
"end": [
941,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.contains",
"code": "def contains (s : Substring) (c : Char) : Bool :=\n s.any (fun a => a == c)",
"start": [
943,
1
],
"end": [
944,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.takeWhileAux",
"code": "@[specialize] def takeWhileAux (s : String) (stopPos : String.Pos) (p : Char → Bool) (i : String.Pos) : String.Pos :=\n if h : i < stopPos then\n if p (s.get i) then\n have := Nat.sub_lt_sub_left h (String.lt_next s i)\n takeWhileAux s stopPos p (s.next i)\n else i\n else i\ntermination_by stopPos.1 - i.1",
"start": [
946,
1
],
"end": [
953,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.takeWhile",
"code": "@[inline] def takeWhile : Substring → (Char → Bool) → Substring\n | ⟨s, b, e⟩, p =>\n let e := takeWhileAux s e p b;\n ⟨s, b, e⟩",
"start": [
955,
1
],
"end": [
958,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.dropWhile",
"code": "@[inline] def dropWhile : Substring → (Char → Bool) → Substring\n | ⟨s, b, e⟩, p =>\n let b := takeWhileAux s e p b;\n ⟨s, b, e⟩",
"start": [
960,
1
],
"end": [
963,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.takeRightWhileAux",
"code": "@[specialize] def takeRightWhileAux (s : String) (begPos : String.Pos) (p : Char → Bool) (i : String.Pos) : String.Pos :=\n if h : begPos < i then\n have := String.prev_lt_of_pos s i <| mt (congrArg String.Pos.byteIdx) <|\n Ne.symm <| Nat.ne_of_lt <| Nat.lt_of_le_of_lt (Nat.zero_le _) h\n let i' := s.prev i\n let c := s.get i'\n if !p c then i\n else takeRightWhileAux s begPos p i'\n else i\ntermination_by i.1",
"start": [
965,
1
],
"end": [
974,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.takeRightWhile",
"code": "@[inline] def takeRightWhile : Substring → (Char → Bool) → Substring\n | ⟨s, b, e⟩, p =>\n let b := takeRightWhileAux s b p e\n ⟨s, b, e⟩",
"start": [
976,
1
],
"end": [
979,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.dropRightWhile",
"code": "@[inline] def dropRightWhile : Substring → (Char → Bool) → Substring\n | ⟨s, b, e⟩, p =>\n let e := takeRightWhileAux s b p e\n ⟨s, b, e⟩",
"start": [
981,
1
],
"end": [
984,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.trimLeft",
"code": "@[inline] def trimLeft (s : Substring) : Substring :=\n s.dropWhile Char.isWhitespace",
"start": [
986,
1
],
"end": [
987,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.trimRight",
"code": "@[inline] def trimRight (s : Substring) : Substring :=\n s.dropRightWhile Char.isWhitespace",
"start": [
989,
1
],
"end": [
990,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.trim",
"code": "@[inline] def trim : Substring → Substring\n | ⟨s, b, e⟩ =>\n let b := takeWhileAux s e Char.isWhitespace b\n let e := takeRightWhileAux s b Char.isWhitespace e\n ⟨s, b, e⟩",
"start": [
992,
1
],
"end": [
996,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.isNat",
"code": "def isNat (s : Substring) : Bool :=\n s.all fun c => c.isDigit",
"start": [
998,
1
],
"end": [
999,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.toNat?",
"code": "def toNat? (s : Substring) : Option Nat :=\n if s.isNat then\n some <| s.foldl (fun n c => n*10 + (c.toNat - '0'.toNat)) 0\n else\n none",
"start": [
1001,
1
],
"end": [
1005,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.beq",
"code": "def beq (ss1 ss2 : Substring) : Bool :=\n ss1.bsize == ss2.bsize && ss1.str.substrEq ss1.startPos ss2.str ss2.startPos ss1.bsize",
"start": [
1007,
1
],
"end": [
1008,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.hasBeq",
"code": "instance hasBeq : BEq Substring := ⟨beq⟩",
"start": [
1010,
1
],
"end": [
1010,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.sameAs",
"code": "def sameAs (ss1 ss2 : Substring) : Bool :=\n ss1.startPos == ss2.startPos && ss1 == ss2",
"start": [
1012,
1
],
"end": [
1014,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "String.drop",
"code": "def drop (s : String) (n : Nat) : String :=\n (s.toSubstring.drop n).toString",
"start": [
1020,
1
],
"end": [
1021,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "String.dropRight",
"code": "def dropRight (s : String) (n : Nat) : String :=\n (s.toSubstring.dropRight n).toString",
"start": [
1023,
1
],
"end": [
1024,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "String.take",
"code": "def take (s : String) (n : Nat) : String :=\n (s.toSubstring.take n).toString",
"start": [
1026,
1
],
"end": [
1027,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "String.takeRight",
"code": "def takeRight (s : String) (n : Nat) : String :=\n (s.toSubstring.takeRight n).toString",
"start": [
1029,
1
],
"end": [
1030,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "String.takeWhile",
"code": "def takeWhile (s : String) (p : Char → Bool) : String :=\n (s.toSubstring.takeWhile p).toString",
"start": [
1032,
1
],
"end": [
1033,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "String.dropWhile",
"code": "def dropWhile (s : String) (p : Char → Bool) : String :=\n (s.toSubstring.dropWhile p).toString",
"start": [
1035,
1
],
"end": [
1036,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "String.takeRightWhile",
"code": "def takeRightWhile (s : String) (p : Char → Bool) : String :=\n (s.toSubstring.takeRightWhile p).toString",
"start": [
1038,
1
],
"end": [
1039,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "String.dropRightWhile",
"code": "def dropRightWhile (s : String) (p : Char → Bool) : String :=\n (s.toSubstring.dropRightWhile p).toString",
"start": [
1041,
1
],
"end": [
1042,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "String.startsWith",
"code": "def startsWith (s pre : String) : Bool :=\n s.toSubstring.take pre.length == pre.toSubstring",
"start": [
1044,
1
],
"end": [
1045,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "String.endsWith",
"code": "def endsWith (s post : String) : Bool :=\n s.toSubstring.takeRight post.length == post.toSubstring",
"start": [
1047,
1
],
"end": [
1048,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "String.trimRight",
"code": "def trimRight (s : String) : String :=\n s.toSubstring.trimRight.toString",
"start": [
1050,
1
],
"end": [
1051,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "String.trimLeft",
"code": "def trimLeft (s : String) : String :=\n s.toSubstring.trimLeft.toString",
"start": [
1053,
1
],
"end": [
1054,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "String.trim",
"code": "def trim (s : String) : String :=\n s.toSubstring.trim.toString",
"start": [
1056,
1
],
"end": [
1057,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "String.nextWhile",
"code": "@[inline] def nextWhile (s : String) (p : Char → Bool) (i : String.Pos) : String.Pos :=\n Substring.takeWhileAux s s.endPos p i",
"start": [
1059,
1
],
"end": [
1060,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "String.nextUntil",
"code": "@[inline] def nextUntil (s : String) (p : Char → Bool) (i : String.Pos) : String.Pos :=\n nextWhile s (fun c => !p c) i",
"start": [
1062,
1
],
"end": [
1063,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toUpper",
"code": "def toUpper (s : String) : String :=\n s.map Char.toUpper",
"start": [
1065,
1
],
"end": [
1066,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toLower",
"code": "def toLower (s : String) : String :=\n s.map Char.toLower",
"start": [
1068,
1
],
"end": [
1069,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "String.capitalize",
"code": "def capitalize (s : String) :=\n s.set 0 <| s.get 0 |>.toUpper",
"start": [
1071,
1
],
"end": [
1072,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.decapitalize",
"code": "def decapitalize (s : String) :=\n s.set 0 <| s.get 0 |>.toLower",
"start": [
1074,
1
],
"end": [
1075,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.toString",
"code": "protected def toString (c : Char) : String :=\n String.singleton c",
"start": [
1081,
1
],
"end": [
1082,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.length_toString",
"code": "@[simp] theorem length_toString (c : Char) : c.toString.length = 1",
"start": [
1084,
1
],
"end": [
1084,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "String.ext",
"code": "theorem ext {s₁ s₂ : String} (h : s₁.data = s₂.data) : s₁ = s₂",
"start": [
1090,
1
],
"end": [
1091,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "String.ext_iff",
"code": "theorem ext_iff {s₁ s₂ : String} : s₁ = s₂ ↔ s₁.data = s₂.data",
"start": [
1093,
1
],
"end": [
1093,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "String.default_eq",
"code": "@[simp] theorem default_eq : default = \"\"",
"start": [
1095,
1
],
"end": [
1095,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_mk",
"code": "@[simp] theorem length_mk (s : List Char) : (String.mk s).length = s.length",
"start": [
1097,
1
],
"end": [
1097,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_empty",
"code": "@[simp] theorem length_empty : \"\".length = 0",
"start": [
1099,
1
],
"end": [
1099,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_singleton",
"code": "@[simp] theorem length_singleton (c : Char) : (String.singleton c).length = 1",
"start": [
1101,
1
],
"end": [
1101,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_push",
"code": "@[simp] theorem length_push (c : Char) : (String.push s c).length = s.length + 1",
"start": [
1103,
1
],
"end": [
1105,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_pushn",
"code": "@[simp] theorem length_pushn (c : Char) (n : Nat) : (pushn s c n).length = s.length + n",
"start": [
1107,
1
],
"end": [
1108,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_append",
"code": "@[simp] theorem length_append (s t : String) : (s ++ t).length = s.length + t.length",
"start": [
1110,
1
],
"end": [
1111,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "String.data_push",
"code": "@[simp] theorem data_push (s : String) (c : Char) : (s.push c).data = s.data ++ [c]",
"start": [
1113,
1
],
"end": [
1113,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "String.data_append",
"code": "@[simp] theorem data_append (s t : String) : (s ++ t).data = s.data ++ t.data",
"start": [
1115,
1
],
"end": [
1115,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "String.lt_iff",
"code": "theorem lt_iff (s t : String) : s < t ↔ s.data < t.data",
"start": [
1119,
1
],
"end": [
1119,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.byteIdx_zero",
"code": "@[simp] theorem byteIdx_zero : (0 : Pos).byteIdx = 0",
"start": [
1123,
1
],
"end": [
1123,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.byteIdx_mk",
"code": "theorem byteIdx_mk (n : Nat) : byteIdx ⟨n⟩ = n",
"start": [
1125,
1
],
"end": [
1125,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.mk_zero",
"code": "@[simp] theorem mk_zero : ⟨0⟩ = (0 : Pos)",
"start": [
1127,
1
],
"end": [
1127,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.mk_byteIdx",
"code": "@[simp] theorem mk_byteIdx (p : Pos) : ⟨p.byteIdx⟩ = p",
"start": [
1129,
1
],
"end": [
1129,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.ext",
"code": "theorem ext {i₁ i₂ : Pos} (h : i₁.byteIdx = i₂.byteIdx) : i₁ = i₂",
"start": [
1131,
1
],
"end": [
1132,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.ext_iff",
"code": "theorem ext_iff {i₁ i₂ : Pos} : i₁ = i₂ ↔ i₁.byteIdx = i₂.byteIdx",
"start": [
1134,
1
],
"end": [
1134,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.add_byteIdx",
"code": "@[simp] theorem add_byteIdx (p₁ p₂ : Pos) : (p₁ + p₂).byteIdx = p₁.byteIdx + p₂.byteIdx",
"start": [
1136,
1
],
"end": [
1136,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.add_eq",
"code": "theorem add_eq (p₁ p₂ : Pos) : p₁ + p₂ = ⟨p₁.byteIdx + p₂.byteIdx⟩",
"start": [
1138,
1
],
"end": [
1138,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.sub_byteIdx",
"code": "@[simp] theorem sub_byteIdx (p₁ p₂ : Pos) : (p₁ - p₂).byteIdx = p₁.byteIdx - p₂.byteIdx",
"start": [
1140,
1
],
"end": [
1140,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.sub_eq",
"code": "theorem sub_eq (p₁ p₂ : Pos) : p₁ - p₂ = ⟨p₁.byteIdx - p₂.byteIdx⟩",
"start": [
1142,
1
],
"end": [
1142,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.addChar_byteIdx",
"code": "@[simp] theorem addChar_byteIdx (p : Pos) (c : Char) : (p + c).byteIdx = p.byteIdx + c.utf8Size",
"start": [
1144,
1
],
"end": [
1144,
103
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.addChar_eq",
"code": "theorem addChar_eq (p : Pos) (c : Char) : p + c = ⟨p.byteIdx + c.utf8Size⟩",
"start": [
1146,
1
],
"end": [
1146,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.zero_addChar_byteIdx",
"code": "theorem zero_addChar_byteIdx (c : Char) : ((0 : Pos) + c).byteIdx = c.utf8Size",
"start": [
1148,
1
],
"end": [
1149,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.zero_addChar_eq",
"code": "theorem zero_addChar_eq (c : Char) : (0 : Pos) + c = ⟨c.utf8Size⟩",
"start": [
1151,
1
],
"end": [
1151,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.addChar_right_comm",
"code": "theorem addChar_right_comm (p : Pos) (c₁ c₂ : Char) : p + c₁ + c₂ = p + c₂ + c₁",
"start": [
1153,
1
],
"end": [
1156,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.ne_of_lt",
"code": "theorem ne_of_lt {i₁ i₂ : Pos} (h : i₁ < i₂) : i₁ ≠ i₂",
"start": [
1158,
1
],
"end": [
1158,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.ne_of_gt",
"code": "theorem ne_of_gt {i₁ i₂ : Pos} (h : i₁ < i₂) : i₂ ≠ i₁",
"start": [
1160,
1
],
"end": [
1160,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.addString_byteIdx",
"code": "@[simp] theorem addString_byteIdx (p : Pos) (s : String) :\n (p + s).byteIdx = p.byteIdx + s.utf8ByteSize",
"start": [
1162,
1
],
"end": [
1163,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.addString_eq",
"code": "theorem addString_eq (p : Pos) (s : String) : p + s = ⟨p.byteIdx + s.utf8ByteSize⟩",
"start": [
1165,
1
],
"end": [
1165,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.zero_addString_byteIdx",
"code": "theorem zero_addString_byteIdx (s : String) : ((0 : Pos) + s).byteIdx = s.utf8ByteSize",
"start": [
1167,
1
],
"end": [
1168,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.zero_addString_eq",
"code": "theorem zero_addString_eq (s : String) : (0 : Pos) + s = ⟨s.utf8ByteSize⟩",
"start": [
1170,
1
],
"end": [
1171,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.le_iff",
"code": "theorem le_iff {i₁ i₂ : Pos} : i₁ ≤ i₂ ↔ i₁.byteIdx ≤ i₂.byteIdx",
"start": [
1173,
1
],
"end": [
1173,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.mk_le_mk",
"code": "@[simp] theorem mk_le_mk {i₁ i₂ : Nat} : Pos.mk i₁ ≤ Pos.mk i₂ ↔ i₁ ≤ i₂",
"start": [
1175,
1
],
"end": [
1175,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.lt_iff",
"code": "theorem lt_iff {i₁ i₂ : Pos} : i₁ < i₂ ↔ i₁.byteIdx < i₂.byteIdx",
"start": [
1177,
1
],
"end": [
1177,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Pos.mk_lt_mk",
"code": "@[simp] theorem mk_lt_mk {i₁ i₂ : Nat} : Pos.mk i₁ < Pos.mk i₂ ↔ i₁ < i₂",
"start": [
1179,
1
],
"end": [
1179,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get!_eq_get",
"code": "@[simp] theorem get!_eq_get (s : String) (p : Pos) : get! s p = get s p",
"start": [
1183,
1
],
"end": [
1183,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "String.lt_next'",
"code": "theorem lt_next' (s : String) (p : Pos) : p < next s p",
"start": [
1185,
1
],
"end": [
1185,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "String.prev_zero",
"code": "@[simp] theorem prev_zero (s : String) : prev s 0 = 0",
"start": [
1187,
1
],
"end": [
1187,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "String.get'_eq",
"code": "@[simp] theorem get'_eq (s : String) (p : Pos) (h) : get' s p h = get s p",
"start": [
1189,
1
],
"end": [
1189,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "String.next'_eq",
"code": "@[simp] theorem next'_eq (s : String) (p : Pos) (h) : next' s p h = next s p",
"start": [
1191,
1
],
"end": [
1191,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "String.singleton_eq",
"code": "theorem singleton_eq (c : Char) : singleton c = ⟨[c]⟩",
"start": [
1197,
1
],
"end": [
1197,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "String.data_singleton",
"code": "@[simp] theorem data_singleton (c : Char) : (singleton c).data = [c]",
"start": [
1199,
1
],
"end": [
1199,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "String.append_empty",
"code": "@[simp] theorem append_empty (s : String) : s ++ \"\" = s",
"start": [
1201,
1
],
"end": [
1201,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "String.empty_append",
"code": "@[simp] theorem empty_append (s : String) : \"\" ++ s = s",
"start": [
1203,
1
],
"end": [
1203,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "String.append_assoc",
"code": "theorem append_assoc (s₁ s₂ s₃ : String) : (s₁ ++ s₂) ++ s₃ = s₁ ++ (s₂ ++ s₃)",
"start": [
1205,
1
],
"end": [
1206,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.prev_zero",
"code": "@[simp] theorem prev_zero (s : Substring) : s.prev 0 = 0",
"start": [
1214,
1
],
"end": [
1214,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.prevn_zero",
"code": "@[simp] theorem prevn_zero (s : Substring) : ∀ n, s.prevn n 0 = 0",
"start": [
1216,
1
],
"end": [
1218,
43
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/State.lean | [
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Except.lean"
] | [
{
"full_name": "StateT",
"code": "def StateT (σ : Type u) (m : Type u → Type v) (α : Type u) : Type (max u v) :=\n σ → m (α × σ)",
"start": [
14,
1
],
"end": [
15,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.run",
"code": "@[always_inline, inline]\ndef StateT.run {σ : Type u} {m : Type u → Type v} {α : Type u} (x : StateT σ m α) (s : σ) : m (α × σ) :=\n x s",
"start": [
17,
1
],
"end": [
19,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.run'",
"code": "@[always_inline, inline]\ndef StateT.run' {σ : Type u} {m : Type u → Type v} [Functor m] {α : Type u} (x : StateT σ m α) (s : σ) : m α :=\n (·.1) <$> x s",
"start": [
21,
1
],
"end": [
23,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "StateM",
"code": "@[reducible]\ndef StateM (σ α : Type u) : Type u := StateT σ Id α",
"start": [
25,
1
],
"end": [
26,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.pure",
"code": "@[always_inline, inline]\nprotected def pure (a : α) : StateT σ m α :=\n fun s => pure (a, s)",
"start": [
41,
1
],
"end": [
43,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.bind",
"code": "@[always_inline, inline]\nprotected def bind (x : StateT σ m α) (f : α → StateT σ m β) : StateT σ m β :=\n fun s => do let (a, s) ← x s; f a s",
"start": [
45,
1
],
"end": [
47,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.map",
"code": "@[always_inline, inline]\nprotected def map (f : α → β) (x : StateT σ m α) : StateT σ m β :=\n fun s => do let (a, s) ← x s; pure (f a, s)",
"start": [
49,
1
],
"end": [
51,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.orElse",
"code": "@[always_inline, inline]\nprotected def orElse [Alternative m] {α : Type u} (x₁ : StateT σ m α) (x₂ : Unit → StateT σ m α) : StateT σ m α :=\n fun s => x₁ s <|> x₂ () s",
"start": [
59,
1
],
"end": [
61,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.failure",
"code": "@[always_inline, inline]\nprotected def failure [Alternative m] {α : Type u} : StateT σ m α :=\n fun _ => failure",
"start": [
63,
1
],
"end": [
65,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.get",
"code": "@[always_inline, inline]\nprotected def get : StateT σ m σ :=\n fun s => pure (s, s)",
"start": [
71,
1
],
"end": [
73,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.set",
"code": "@[always_inline, inline]\nprotected def set : σ → StateT σ m PUnit :=\n fun s' _ => pure (⟨⟩, s')",
"start": [
75,
1
],
"end": [
77,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.modifyGet",
"code": "@[always_inline, inline]\nprotected def modifyGet (f : σ → α × σ) : StateT σ m α :=\n fun s => pure (f s)",
"start": [
79,
1
],
"end": [
81,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.lift",
"code": "@[always_inline, inline]\nprotected def lift {α : Type u} (t : m α) : StateT σ m α :=\n fun s => do let a ← t; pure (a, s)",
"start": [
83,
1
],
"end": [
85,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ForM.forIn",
"code": "@[always_inline, inline]\ndef ForM.forIn [Monad m] [ForM (StateT β (ExceptT β m)) ρ α]\n (x : ρ) (b : β) (f : α → β → m (ForInStep β)) : m β := do\n let g a b := .mk do\n match ← f a b with\n | .yield b' => pure (.ok (⟨⟩, b'))\n | .done b' => pure (.error b')\n match ← forM (m := StateT β (ExceptT β m)) (α := α) x g |>.run b |>.run with\n | .ok a => pure a.2\n | .error a => pure a",
"start": [
101,
1
],
"end": [
111,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.monadControl",
"code": "@[always_inline]\ninstance StateT.monadControl (σ : Type u) (m : Type u → Type v) [Monad m] : MonadControl m (StateT σ m) where\n stM := fun α => α × σ\n liftWith := fun f => do let s ← get; liftM (f (fun x => x.run s))\n restoreM := fun x => do let (a, s) ← liftM x; set s; pure a",
"start": [
123,
1
],
"end": [
127,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "StateT.tryFinally",
"code": "@[always_inline]\ninstance StateT.tryFinally {m : Type u → Type v} {σ : Type u} [MonadFinally m] [Monad m] : MonadFinally (StateT σ m) where\n tryFinally' := fun x h s => do\n let ((a, _), (b, s'')) ← tryFinally' (x s) fun\n | some (a, s') => h (some a) s'\n | none => h none s\n pure ((a, b), s'')",
"start": [
129,
1
],
"end": [
135,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Format/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Control/State.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean"
] | [
{
"full_name": "Std.Format.FlattenBehavior",
"code": "inductive Format.FlattenBehavior where\n | allOrNone\n | fill\n deriving Inhabited, BEq",
"start": [
13,
1
],
"end": [
31,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format",
"code": "inductive Format where\n \n | nil : Format\n \n | line : Format\n \n | align (force : Bool) : Format\n \n | text : String → Format\n \n | nest (indent : Int) : Format → Format\n \n | append : Format → Format → Format\n \n | group : Format → (behavior : FlattenBehavior := FlattenBehavior.allOrNone) → Format\n \n | tag : Nat → Format → Format\n deriving Inhabited",
"start": [
34,
1
],
"end": [
78,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.isEmpty",
"code": "def isEmpty : Format → Bool\n | nil => true\n | line => false\n | align _ => true\n | text msg => msg == \"\"\n | nest _ f => f.isEmpty\n | append f₁ f₂ => f₁.isEmpty && f₂.isEmpty\n | group f _ => f.isEmpty\n | tag _ f => f.isEmpty",
"start": [
82,
1
],
"end": [
91,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.fill",
"code": "def fill (f : Format) : Format :=\n group f (behavior := FlattenBehavior.fill)",
"start": [
93,
1
],
"end": [
95,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.join",
"code": "def join (xs : List Format) : Format :=\n xs.foldl (·++·) \"\"",
"start": [
100,
1
],
"end": [
101,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.isNil",
"code": "def isNil : Format → Bool\n | nil => true\n | _ => false",
"start": [
103,
1
],
"end": [
105,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.SpaceResult",
"code": "private structure SpaceResult where\n foundLine : Bool := false\n foundFlattenedHardLine : Bool := false\n space : Nat := 0\n deriving Inhabited",
"start": [
107,
1
],
"end": [
111,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.merge",
"code": "@[inline] private def merge (w : Nat) (r₁ : SpaceResult) (r₂ : Nat → SpaceResult) : SpaceResult :=\n if r₁.space > w || r₁.foundLine then\n r₁\n else\n let r₂ := r₂ (w - r₁.space);\n { r₂ with space := r₁.space + r₂.space }",
"start": [
113,
1
],
"end": [
118,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.spaceUptoLine",
"code": "private def spaceUptoLine : Format → Bool → Int → Nat → SpaceResult\n | nil, _, _, _ => {}\n | line, flatten, _, _ => if flatten then { space := 1 } else { foundLine := true }\n | align force, flatten, m, w =>\n if flatten && !force then {}\n else if w < m then\n { space := (m - w).toNat }\n else\n { foundLine := true }\n | text s, flatten, _, _ =>\n let p := s.posOf '\\n'\n let off := s.offsetOfPos p\n { foundLine := p != s.endPos, foundFlattenedHardLine := flatten && p != s.endPos, space := off }\n | append f₁ f₂, flatten, m, w => merge w (spaceUptoLine f₁ flatten m w) (spaceUptoLine f₂ flatten m)\n | nest n f, flatten, m, w => spaceUptoLine f flatten (m - n) w\n | group f _, _, m, w => spaceUptoLine f true m w\n | tag _ f, flatten, m, w => spaceUptoLine f flatten m w",
"start": [
120,
1
],
"end": [
136,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.WorkItem",
"code": "private structure WorkItem where\n f : Format\n indent : Int\n activeTags : Nat",
"start": [
138,
1
],
"end": [
141,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.WorkGroup",
"code": "private structure WorkGroup where\n flatten : Bool\n flb : FlattenBehavior\n items : List WorkItem",
"start": [
143,
1
],
"end": [
146,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.spaceUptoLine'",
"code": "private partial def spaceUptoLine' : List WorkGroup → Nat → Nat → SpaceResult\n | [], _, _ => {}\n | { items := [], .. }::gs, col, w => spaceUptoLine' gs col w\n | g@{ items := i::is, .. }::gs, col, w =>\n merge w\n (spaceUptoLine i.f g.flatten (w + col - i.indent) w)\n (spaceUptoLine' ({ g with items := is }::gs) col)",
"start": [
148,
1
],
"end": [
154,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.MonadPrettyFormat",
"code": "class MonadPrettyFormat (m : Type → Type) where\n pushOutput (s : String) : m Unit\n pushNewline (indent : Nat) : m Unit\n currColumn : m Nat\n \n startTag : Nat → m Unit\n \n endTags : Nat → m Unit",
"start": [
156,
1
],
"end": [
164,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.pushGroup",
"code": "private def pushGroup (flb : FlattenBehavior) (items : List WorkItem) (gs : List WorkGroup) (w : Nat) [Monad m] [MonadPrettyFormat m] : m (List WorkGroup) := do\n let k ← currColumn\n let g := { flatten := flb == FlattenBehavior.allOrNone, flb := flb, items := items : WorkGroup }\n let r := spaceUptoLine' [g] k (w-k)\n let r' := merge (w-k) r (spaceUptoLine' gs k)\n return { g with flatten := !r.foundFlattenedHardLine && r'.space <= w-k }::gs",
"start": [
167,
1
],
"end": [
174,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.be",
"code": "private partial def be (w : Nat) [Monad m] [MonadPrettyFormat m] : List WorkGroup → m Unit\n | [] => pure ()\n | { items := [], .. }::gs => be w gs\n | g@{ items := i::is, .. }::gs => do\n let gs' (is' : List WorkItem) := { g with items := is' }::gs;\n match i.f with\n | nil =>\n endTags i.activeTags\n be w (gs' is)\n | tag t f =>\n startTag t\n be w (gs' ({ i with f, activeTags := i.activeTags + 1 }::is))\n | append f₁ f₂ => be w (gs' ({ i with f := f₁, activeTags := 0 }::{ i with f := f₂ }::is))\n | nest n f => be w (gs' ({ i with f, indent := i.indent + n }::is))\n | text s =>\n let p := s.posOf '\\n'\n if p == s.endPos then\n pushOutput s\n endTags i.activeTags\n be w (gs' is)\n else\n pushOutput (s.extract {} p)\n pushNewline i.indent.toNat\n let is := { i with f := text (s.extract (s.next p) s.endPos) }::is\n pushGroup g.flb is gs w >>= be w\n | line =>\n match g.flb with\n | FlattenBehavior.allOrNone =>\n if g.flatten then\n pushOutput \" \"\n endTags i.activeTags\n be w (gs' is)\n else\n pushNewline i.indent.toNat\n endTags i.activeTags\n be w (gs' is)\n | FlattenBehavior.fill =>\n let breakHere := do\n pushNewline i.indent.toNat\n endTags i.activeTags\n pushGroup FlattenBehavior.fill is gs w >>= be w\n if g.flatten then\n let gs'@(g'::_) ← pushGroup FlattenBehavior.fill is gs (w - \" \".length)\n | panic \"unreachable\"\n if g'.flatten then\n pushOutput \" \"\n endTags i.activeTags\n be w gs' else\n breakHere\n else\n breakHere\n | align force =>\n if g.flatten && !force then\n endTags i.activeTags\n be w (gs' is)\n else\n let k ← currColumn\n if k < i.indent then\n pushOutput (\"\".pushn ' ' (i.indent - k).toNat)\n endTags i.activeTags\n be w (gs' is)\n else\n pushNewline i.indent.toNat\n endTags i.activeTags\n be w (gs' is)\n | group f flb =>\n if g.flatten then\n be w (gs' ({ i with f }::is))\n else\n pushGroup flb [{ i with f }] (gs' is) w >>= be w",
"start": [
176,
1
],
"end": [
252,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.prettyM",
"code": "def prettyM (f : Format) (w : Nat) (indent : Nat := 0) [Monad m] [MonadPrettyFormat m] : m Unit :=\n be w [{ flb := FlattenBehavior.allOrNone, flatten := false, items := [{ f := f, indent, activeTags := 0 }]}]",
"start": [
254,
1
],
"end": [
257,
111
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.bracket",
"code": "@[inline] def bracket (l : String) (f : Format) (r : String) : Format :=\n group (nest l.length $ l ++ f ++ r)",
"start": [
259,
1
],
"end": [
262,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.paren",
"code": "@[inline] def paren (f : Format) : Format :=\n bracket \"(\" f \")\"",
"start": [
264,
1
],
"end": [
266,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.sbracket",
"code": "@[inline] def sbracket (f : Format) : Format :=\n bracket \"[\" f \"]\"",
"start": [
268,
1
],
"end": [
270,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.bracketFill",
"code": "@[inline] def bracketFill (l : String) (f : Format) (r : String) : Format :=\n fill (nest l.length $ l ++ f ++ r)",
"start": [
272,
1
],
"end": [
274,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.defIndent",
"code": "def defIndent := 2",
"start": [
276,
1
],
"end": [
277,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.defUnicode",
"code": "def defUnicode := true",
"start": [
278,
1
],
"end": [
278,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.defWidth",
"code": "def defWidth := 120",
"start": [
279,
1
],
"end": [
280,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.nestD",
"code": "def nestD (f : Format) : Format :=\n nest defIndent f",
"start": [
282,
1
],
"end": [
284,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.indentD",
"code": "def indentD (f : Format) : Format :=\n nestD (Format.line ++ f)",
"start": [
286,
1
],
"end": [
288,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.State",
"code": "private structure State where\n out : String := \"\"\n column : Nat := 0",
"start": [
290,
1
],
"end": [
293,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.pretty",
"code": "@[export lean_format_pretty]\ndef pretty (f : Format) (width : Nat := defWidth) (indent : Nat := 0) (column := 0) : String :=\n let act : StateM State Unit := prettyM f width indent\n State.out <| act (State.mk \"\" column) |>.snd",
"start": [
303,
1
],
"end": [
314,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.ToFormat",
"code": "class ToFormat (α : Type u) where\n format : α → Format",
"start": [
318,
1
],
"end": [
321,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.joinSep",
"code": "def Format.joinSep {α : Type u} [ToFormat α] : List α → Format → Format\n | [], _ => nil\n | [a], _ => format a\n | a::as, sep => as.foldl (· ++ sep ++ format ·) (format a)",
"start": [
332,
1
],
"end": [
336,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.prefixJoin",
"code": "def Format.prefixJoin {α : Type u} [ToFormat α] (pre : Format) : List α → Format\n | [] => nil\n | a::as => as.foldl (· ++ pre ++ format ·) (pre ++ format a)",
"start": [
338,
1
],
"end": [
341,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Std.Format.joinSuffix",
"code": "def Format.joinSuffix {α : Type u} [ToFormat α] : List α → Format → Format\n | [], _ => nil\n | a::as, suffix => as.foldl (· ++ format · ++ suffix) (format a ++ suffix)",
"start": [
343,
1
],
"end": [
346,
77
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Repr.lean | [
".lake/packages/lean4/src/lean/Init/Data/Format/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean"
] | [
{
"full_name": "Repr",
"code": "class Repr (α : Type u) where\n \n reprPrec : α → Nat → Format",
"start": [
16,
1
],
"end": [
27,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "repr",
"code": "abbrev repr [Repr α] (a : α) : Format :=\n reprPrec a 0",
"start": [
31,
1
],
"end": [
35,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "reprStr",
"code": "abbrev reprStr [Repr α] (a : α) : String :=\n reprPrec a 0 |>.pretty",
"start": [
37,
1
],
"end": [
38,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "reprArg",
"code": "abbrev reprArg [Repr α] (a : α) : Format :=\n reprPrec a max_prec",
"start": [
40,
1
],
"end": [
41,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "ReprAtom",
"code": "class ReprAtom (α : Type u)",
"start": [
43,
1
],
"end": [
45,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Repr.addAppParen",
"code": "def Repr.addAppParen (f : Format) (prec : Nat) : Format :=\n if prec >= max_prec then\n Format.paren f\n else\n f",
"start": [
59,
1
],
"end": [
63,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.repr",
"code": "protected def Option.repr [Repr α] : Option α → Nat → Format\n | none, _ => \"none\"\n | some a, prec => Repr.addAppParen (\"some \" ++ reprArg a) prec",
"start": [
80,
1
],
"end": [
82,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Sum.repr",
"code": "protected def Sum.repr [Repr α] [Repr β] : Sum α β → Nat → Format\n | Sum.inl a, prec => Repr.addAppParen (\"Sum.inl \" ++ reprArg a) prec\n | Sum.inr b, prec => Repr.addAppParen (\"Sum.inr \" ++ reprArg b) prec",
"start": [
87,
1
],
"end": [
89,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "ReprTuple",
"code": "class ReprTuple (α : Type u) where\n reprTuple : α → List Format → List Format",
"start": [
94,
1
],
"end": [
95,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.repr",
"code": "protected def Prod.repr [Repr α] [ReprTuple β] : α × β → Nat → Format\n | (a, b), _ => Format.bracket \"(\" (Format.joinSep (reprTuple b [repr a]).reverse (\",\" ++ Format.line)) \")\"",
"start": [
105,
1
],
"end": [
106,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.digitChar",
"code": "def digitChar (n : Nat) : Char :=\n if n = 0 then '0' else\n if n = 1 then '1' else\n if n = 2 then '2' else\n if n = 3 then '3' else\n if n = 4 then '4' else\n if n = 5 then '5' else\n if n = 6 then '6' else\n if n = 7 then '7' else\n if n = 8 then '8' else\n if n = 9 then '9' else\n if n = 0xa then 'a' else\n if n = 0xb then 'b' else\n if n = 0xc then 'c' else\n if n = 0xd then 'd' else\n if n = 0xe then 'e' else\n if n = 0xf then 'f' else\n '*'",
"start": [
124,
1
],
"end": [
141,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toDigitsCore",
"code": "def toDigitsCore (base : Nat) : Nat → Nat → List Char → List Char\n | 0, _, ds => ds\n | fuel+1, n, ds =>\n let d := digitChar <| n % base;\n let n' := n / base;\n if n' = 0 then d::ds\n else toDigitsCore base fuel n' (d::ds)",
"start": [
143,
1
],
"end": [
149,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toDigits",
"code": "def toDigits (base : Nat) (n : Nat) : List Char :=\n toDigitsCore base (n+1) n []",
"start": [
151,
1
],
"end": [
152,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "USize.repr",
"code": "@[extern \"lean_string_of_usize\"]\nprotected def _root_.USize.repr (n : @& USize) : String :=\n (toDigits 10 n.toNat).asString",
"start": [
154,
1
],
"end": [
156,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.reprArray",
"code": "private def reprArray : Array String := Id.run do\n List.range 128 |>.map (·.toUSize.repr) |> Array.mk",
"start": [
158,
1
],
"end": [
160,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.reprFast",
"code": "private def reprFast (n : Nat) : String :=\n if h : n < 128 then Nat.reprArray.get ⟨n, h⟩ else\n if h : n < USize.size then (USize.ofNatCore n h).repr\n else (toDigits 10 n).asString",
"start": [
162,
1
],
"end": [
165,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.repr",
"code": "@[implemented_by reprFast]\nprotected def repr (n : Nat) : String :=\n (toDigits 10 n).asString",
"start": [
167,
1
],
"end": [
169,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.superDigitChar",
"code": "def superDigitChar (n : Nat) : Char :=\n if n = 0 then '⁰' else\n if n = 1 then '¹' else\n if n = 2 then '²' else\n if n = 3 then '³' else\n if n = 4 then '⁴' else\n if n = 5 then '⁵' else\n if n = 6 then '⁶' else\n if n = 7 then '⁷' else\n if n = 8 then '⁸' else\n if n = 9 then '⁹' else\n '*'",
"start": [
171,
1
],
"end": [
182,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSuperDigitsAux",
"code": "partial def toSuperDigitsAux : Nat → List Char → List Char\n | n, ds =>\n let d := superDigitChar <| n % 10;\n let n' := n / 10;\n if n' = 0 then d::ds\n else toSuperDigitsAux n' (d::ds)",
"start": [
184,
1
],
"end": [
189,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSuperDigits",
"code": "def toSuperDigits (n : Nat) : List Char :=\n toSuperDigitsAux n []",
"start": [
191,
1
],
"end": [
192,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSuperscriptString",
"code": "def toSuperscriptString (n : Nat) : String :=\n (toSuperDigits n).asString",
"start": [
194,
1
],
"end": [
195,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.subDigitChar",
"code": "def subDigitChar (n : Nat) : Char :=\n if n = 0 then '₀' else\n if n = 1 then '₁' else\n if n = 2 then '₂' else\n if n = 3 then '₃' else\n if n = 4 then '₄' else\n if n = 5 then '₅' else\n if n = 6 then '₆' else\n if n = 7 then '₇' else\n if n = 8 then '₈' else\n if n = 9 then '₉' else\n '*'",
"start": [
197,
1
],
"end": [
208,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSubDigitsAux",
"code": "partial def toSubDigitsAux : Nat → List Char → List Char\n | n, ds =>\n let d := subDigitChar <| n % 10;\n let n' := n / 10;\n if n' = 0 then d::ds\n else toSubDigitsAux n' (d::ds)",
"start": [
210,
1
],
"end": [
215,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSubDigits",
"code": "def toSubDigits (n : Nat) : List Char :=\n toSubDigitsAux n []",
"start": [
217,
1
],
"end": [
218,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.toSubscriptString",
"code": "def toSubscriptString (n : Nat) : String :=\n (toSubDigits n).asString",
"start": [
220,
1
],
"end": [
221,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.repr",
"code": "protected def Int.repr : Int → String\n | ofNat m => Nat.repr m\n | negSucc m => \"-\" ++ Nat.repr (succ m)",
"start": [
228,
1
],
"end": [
230,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "hexDigitRepr",
"code": "def hexDigitRepr (n : Nat) : String :=\n String.singleton <| Nat.digitChar n",
"start": [
235,
1
],
"end": [
236,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.quoteCore",
"code": "def Char.quoteCore (c : Char) : String :=\n if c = '\\n' then \"\\\\n\"\n else if c = '\\t' then \"\\\\t\"\n else if c = '\\\\' then \"\\\\\\\\\"\n else if c = '\\\"' then \"\\\\\\\"\"\n else if c.toNat <= 31 ∨ c = '\\x7f' then \"\\\\x\" ++ smallCharToHex c\n else String.singleton c\nwhere\n smallCharToHex (c : Char) : String :=\n let n := Char.toNat c;\n let d2 := n / 16;\n let d1 := n % 16;\n hexDigitRepr d2 ++ hexDigitRepr d1",
"start": [
238,
1
],
"end": [
250,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.quote",
"code": "def Char.quote (c : Char) : String :=\n \"'\" ++ Char.quoteCore c ++ \"'\"",
"start": [
252,
1
],
"end": [
253,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.repr",
"code": "protected def Char.repr (c : Char) : String :=\n c.quote",
"start": [
258,
1
],
"end": [
259,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "String.quote",
"code": "def String.quote (s : String) : String :=\n if s.isEmpty then \"\\\"\\\"\"\n else s.foldl (fun s c => s ++ c.quoteCore) \"\\\"\" ++ \"\\\"\"",
"start": [
261,
1
],
"end": [
263,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.repr",
"code": "protected def List.repr [Repr α] (a : List α) (n : Nat) : Format :=\n let _ : ToFormat α := ⟨repr⟩\n match a, n with\n | [], _ => \"[]\"\n | as, _ => Format.bracket \"[\" (Format.joinSep as (\",\" ++ Format.line)) \"]\"",
"start": [
295,
1
],
"end": [
299,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.repr'",
"code": "protected def List.repr' [Repr α] [ReprAtom α] (a : List α) (n : Nat) : Format :=\n let _ : ToFormat α := ⟨repr⟩\n match a, n with\n | [], _ => \"[]\"\n | as, _ => Format.bracketFill \"[\" (Format.joinSep as (\",\" ++ Format.line)) \"]\"",
"start": [
304,
1
],
"end": [
308,
81
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/Option.lean | [
".lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Except.lean"
] | [
{
"full_name": "OptionT",
"code": "def OptionT (m : Type u → Type v) (α : Type u) : Type v :=\n m (Option α)",
"start": [
15,
1
],
"end": [
16,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.run",
"code": "@[always_inline, inline]\ndef OptionT.run {m : Type u → Type v} {α : Type u} (x : OptionT m α) : m (Option α) :=\n x",
"start": [
18,
1
],
"end": [
20,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.mk",
"code": "protected def mk (x : m (Option α)) : OptionT m α :=\n x",
"start": [
25,
1
],
"end": [
26,
4
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.bind",
"code": "@[always_inline, inline]\nprotected def bind (x : OptionT m α) (f : α → OptionT m β) : OptionT m β := OptionT.mk do\n match (← x) with\n | some a => f a\n | none => pure none",
"start": [
28,
1
],
"end": [
32,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.pure",
"code": "@[always_inline, inline]\nprotected def pure (a : α) : OptionT m α := OptionT.mk do\n pure (some a)",
"start": [
34,
1
],
"end": [
36,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.orElse",
"code": "@[always_inline, inline] protected def orElse (x : OptionT m α) (y : Unit → OptionT m α) : OptionT m α := OptionT.mk do\n match (← x) with\n | some a => pure (some a)\n | _ => y ()",
"start": [
43,
1
],
"end": [
46,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.fail",
"code": "@[always_inline, inline] protected def fail : OptionT m α := OptionT.mk do\n pure none",
"start": [
48,
1
],
"end": [
49,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.lift",
"code": "@[always_inline, inline] protected def lift (x : m α) : OptionT m α := OptionT.mk do\n return some (← x)",
"start": [
55,
1
],
"end": [
56,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "OptionT.tryCatch",
"code": "@[always_inline, inline] protected def tryCatch (x : OptionT m α) (handle : Unit → OptionT m α) : OptionT m α := OptionT.mk do\n let some a ← x | handle ()\n pure a",
"start": [
62,
1
],
"end": [
64,
9
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Format/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Option.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean",
".lake/packages/lean4/src/lean/Init/Data/Repr.lean"
] | [
{
"full_name": "ToString",
"code": "class ToString (α : Type u) where\n toString : α → String",
"start": [
19,
1
],
"end": [
20,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toString",
"code": "protected def List.toString [ToString α] : List α → String\n | [] => \"[]\"\n | [x] => \"[\" ++ toString x ++ \"]\"\n | x::xs => xs.foldl (· ++ \", \" ++ toString ·) (\"[\" ++ toString x) |>.push ']'",
"start": [
48,
1
],
"end": [
51,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "addParenHeuristic",
"code": "def addParenHeuristic (s : String) : String :=\n if \"(\".isPrefixOf s || \"[\".isPrefixOf s || \"{\".isPrefixOf s || \"#[\".isPrefixOf s then s\n else if !s.any Char.isWhitespace then s\n else \"(\" ++ s ++ \")\"",
"start": [
100,
1
],
"end": [
103,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toInt?",
"code": "def String.toInt? (s : String) : Option Int := do\n if s.get 0 = '-' then do\n let v ← (s.toSubstring.drop 1).toNat?;\n pure <| - Int.ofNat v\n else\n Int.ofNat <$> s.toNat?",
"start": [
122,
1
],
"end": [
127,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.isInt",
"code": "def String.isInt (s : String) : Bool :=\n if s.get 0 = '-' then\n (s.toSubstring.drop 1).isNat\n else\n s.isNat",
"start": [
129,
1
],
"end": [
133,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toInt!",
"code": "def String.toInt! (s : String) : Int :=\n match s.toInt? with\n | some v => v\n | none => panic \"Int expected\"",
"start": [
135,
1
],
"end": [
138,
35
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Util.lean | [
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean"
] | [
{
"full_name": "dbgTrace",
"code": "@[never_extract, extern \"lean_dbg_trace\"]\ndef dbgTrace {α : Type u} (s : String) (f : Unit → α) : α := f ()",
"start": [
15,
1
],
"end": [
16,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "dbgTraceVal",
"code": "def dbgTraceVal {α : Type u} [ToString α] (a : α) : α :=\n dbgTrace (toString a) (fun _ => a)",
"start": [
18,
1
],
"end": [
19,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "dbgTraceIfShared",
"code": "@[never_extract, extern \"lean_dbg_trace_if_shared\"]\ndef dbgTraceIfShared {α : Type u} (s : String) (a : α) : α := a",
"start": [
22,
1
],
"end": [
24,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "dbgStackTrace",
"code": "@[never_extract, extern \"lean_dbg_stack_trace\"]\ndef dbgStackTrace {α : Type u} (f : Unit → α) : α := f ()",
"start": [
26,
1
],
"end": [
28,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "dbgSleep",
"code": "@[extern \"lean_dbg_sleep\"]\ndef dbgSleep {α : Type u} (ms : UInt32) (f : Unit → α) : α := f ()",
"start": [
30,
1
],
"end": [
31,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "mkPanicMessage",
"code": "@[noinline] private def mkPanicMessage (modName : String) (line col : Nat) (msg : String) : String :=\n \"PANIC at \" ++ modName ++ \":\" ++ toString line ++ \":\" ++ toString col ++ \": \" ++ msg",
"start": [
33,
1
],
"end": [
34,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "panicWithPos",
"code": "@[never_extract, inline] def panicWithPos {α : Type u} [Inhabited α] (modName : String) (line col : Nat) (msg : String) : α :=\n panic (mkPanicMessage modName line col msg)",
"start": [
36,
1
],
"end": [
37,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "mkPanicMessageWithDecl",
"code": "@[noinline] private def mkPanicMessageWithDecl (modName : String) (declName : String) (line col : Nat) (msg : String) : String :=\n \"PANIC at \" ++ declName ++ \" \" ++ modName ++ \":\" ++ toString line ++ \":\" ++ toString col ++ \": \" ++ msg",
"start": [
39,
1
],
"end": [
40,
106
],
"kind": "commanddeclaration"
},
{
"full_name": "panicWithPosWithDecl",
"code": "@[never_extract, inline] def panicWithPosWithDecl {α : Type u} [Inhabited α] (modName : String) (declName : String) (line col : Nat) (msg : String) : α :=\n panic (mkPanicMessageWithDecl modName declName line col msg)",
"start": [
42,
1
],
"end": [
43,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "ptrAddrUnsafe",
"code": "@[extern \"lean_ptr_addr\"]\nunsafe opaque ptrAddrUnsafe {α : Type u} (a : @& α) : USize",
"start": [
45,
1
],
"end": [
46,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "withPtrAddrUnsafe",
"code": "@[inline] unsafe def withPtrAddrUnsafe {α : Type u} {β : Type v} (a : α) (k : USize → β) (h : ∀ u₁ u₂, k u₁ = k u₂) : β :=\n k (ptrAddrUnsafe a)",
"start": [
49,
1
],
"end": [
50,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "ptrEq",
"code": "@[inline] unsafe def ptrEq (a b : α) : Bool := ptrAddrUnsafe a == ptrAddrUnsafe b",
"start": [
52,
1
],
"end": [
52,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "ptrEqList",
"code": "unsafe def ptrEqList : (as bs : List α) → Bool\n | [], [] => true\n | a::as, b::bs => if ptrEq a b then ptrEqList as bs else false\n | _, _ => false",
"start": [
54,
1
],
"end": [
57,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "withPtrEqUnsafe",
"code": "@[inline] unsafe def withPtrEqUnsafe {α : Type u} (a b : α) (k : Unit → Bool) (h : a = b → k () = true) : Bool :=\n if ptrEq a b then true else k ()",
"start": [
60,
1
],
"end": [
61,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "withPtrEq",
"code": "@[implemented_by withPtrEqUnsafe]\ndef withPtrEq {α : Type u} (a b : α) (k : Unit → Bool) (h : a = b → k () = true) : Bool := k ()",
"start": [
63,
1
],
"end": [
64,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "withPtrEqDecEq",
"code": "@[inline] def withPtrEqDecEq {α : Type u} (a b : α) (k : Unit → Decidable (a = b)) : Decidable (a = b) :=\n let b := withPtrEq a b (fun _ => toBoolUsing (k ())) (toBoolUsing_eq_true (k ()));\n match h:b with\n | true => isTrue (ofBoolUsing_eq_true h)\n | false => isFalse (ofBoolUsing_eq_false h)",
"start": [
66,
1
],
"end": [
71,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "withPtrAddr",
"code": "@[implemented_by withPtrAddrUnsafe]\ndef withPtrAddr {α : Type u} {β : Type v} (a : α) (k : USize → β) (h : ∀ u₁ u₂, k u₁ = k u₂) : β := k 0",
"start": [
73,
1
],
"end": [
74,
104
],
"kind": "commanddeclaration"
},
{
"full_name": "Runtime.markMultiThreaded",
"code": "@[extern \"lean_runtime_mark_multi_threaded\"]\ndef Runtime.markMultiThreaded (a : α) : α := a",
"start": [
76,
1
],
"end": [
83,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Runtime.markPersistent",
"code": "@[extern \"lean_runtime_mark_persistent\"]\ndef Runtime.markPersistent (a : α) : α := a",
"start": [
85,
1
],
"end": [
92,
44
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/GetElem.lean | [
".lake/packages/lean4/src/lean/Init/Util.lean"
] | [
{
"full_name": "outOfBounds",
"code": "@[never_extract]\ndef outOfBounds [Inhabited α] : α :=\n panic! \"index out of bounds\"",
"start": [
9,
1
],
"end": [
11,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "outOfBounds_eq_default",
"code": "theorem outOfBounds_eq_default [Inhabited α] : (outOfBounds : α) = default",
"start": [
13,
1
],
"end": [
13,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "GetElem",
"code": "class GetElem (coll : Type u) (idx : Type v) (elem : outParam (Type w))\n (valid : outParam (coll → idx → Prop)) where\n \n getElem (xs : coll) (i : idx) (h : valid xs i) : elem",
"start": [
15,
1
],
"end": [
69,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "decidableGetElem?",
"code": "abbrev decidableGetElem? [GetElem coll idx elem valid] (xs : coll) (i : idx) [Decidable (valid xs i)] :\n Option elem :=\n if h : valid xs i then some xs[i] else none",
"start": [
81,
1
],
"end": [
84,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "GetElem?",
"code": "@[inherit_doc GetElem]\nclass GetElem? (coll : Type u) (idx : Type v) (elem : outParam (Type w))\n (valid : outParam (coll → idx → Prop)) extends GetElem coll idx elem valid where\n \n getElem? : coll → idx → Option elem\n\n \n getElem! [Inhabited elem] (xs : coll) (i : idx) : elem :=\n match getElem? xs i with | some e => e | none => outOfBounds",
"start": [
86,
1
],
"end": [
101,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulGetElem",
"code": "class LawfulGetElem (cont : Type u) (idx : Type v) (elem : outParam (Type w))\n (dom : outParam (cont → idx → Prop)) [ge : GetElem? cont idx elem dom] : Prop where\n\n getElem?_def (c : cont) (i : idx) [Decidable (dom c i)] :\n c[i]? = if h : dom c i then some (c[i]'h) else none := by\n intros\n try simp only [getElem?] <;> congr\n getElem!_def [Inhabited elem] (c : cont) (i : idx) :\n c[i]! = match c[i]? with | some e => e | none => default := by\n intros\n simp only [getElem!, getElem?, outOfBounds_eq_default]",
"start": [
121,
1
],
"end": [
131,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "getElem?_pos",
"code": "theorem getElem?_pos [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]\n (c : cont) (i : idx) (h : dom c i) [Decidable (dom c i)] : c[i]? = some (c[i]'h)",
"start": [
138,
1
],
"end": [
141,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "getElem?_neg",
"code": "theorem getElem?_neg [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]\n (c : cont) (i : idx) (h : ¬dom c i) [Decidable (dom c i)] : c[i]? = none",
"start": [
143,
1
],
"end": [
146,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "getElem!_pos",
"code": "theorem getElem!_pos [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]\n [Inhabited elem] (c : cont) (i : idx) (h : dom c i) [Decidable (dom c i)] :\n c[i]! = c[i]'h",
"start": [
148,
1
],
"end": [
151,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "getElem!_neg",
"code": "theorem getElem!_neg [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]\n [Inhabited elem] (c : cont) (i : idx) (h : ¬dom c i) [Decidable (dom c i)] : c[i]! = default",
"start": [
153,
1
],
"end": [
155,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.instGetElemFinVal",
"code": "instance instGetElemFinVal [GetElem cont Nat elem dom] : GetElem cont (Fin n) elem fun xs i => dom xs i where\n getElem xs i h := getElem xs i.1 h",
"start": [
159,
1
],
"end": [
160,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.instGetElem?FinVal",
"code": "instance instGetElem?FinVal [GetElem? cont Nat elem dom] : GetElem? cont (Fin n) elem fun xs i => dom xs i where\n getElem? xs i := getElem? xs i.val\n getElem! xs i := getElem! xs i.val",
"start": [
162,
1
],
"end": [
164,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.getElem_fin",
"code": "@[simp] theorem getElem_fin [GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n) (h : Dom a i) :\n a[i] = a[i.1]",
"start": [
171,
1
],
"end": [
172,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.getElem?_fin",
"code": "@[simp] theorem getElem?_fin [h : GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n)\n [Decidable (Dom a i)] : a[i]? = a[i.1]?",
"start": [
174,
1
],
"end": [
175,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.getElem!_fin",
"code": "@[simp] theorem getElem!_fin [GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n)\n [Decidable (Dom a i)] [Inhabited Elem] : a[i]! = a[i.1]!",
"start": [
177,
1
],
"end": [
178,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_cons_zero",
"code": "@[simp] theorem getElem_cons_zero (a : α) (as : List α) (h : 0 < (a :: as).length) : getElem (a :: as) 0 h = a",
"start": [
190,
1
],
"end": [
191,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_getElem_zero",
"code": "@[deprecated (since := \"2024-6-12\")] abbrev cons_getElem_zero := @getElem_cons_zero",
"start": [
193,
1
],
"end": [
193,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_cons_succ",
"code": "@[simp] theorem getElem_cons_succ (a : α) (as : List α) (i : Nat) (h : i + 1 < (a :: as).length) : getElem (a :: as) (i+1) h = getElem as i (Nat.lt_of_succ_lt_succ h)",
"start": [
195,
1
],
"end": [
196,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_getElem_succ",
"code": "@[deprecated (since := \"2024-6-12\")] abbrev cons_getElem_succ := @getElem_cons_succ",
"start": [
198,
1
],
"end": [
198,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_drop_eq_drop",
"code": "theorem get_drop_eq_drop (as : List α) (i : Nat) (h : i < as.length) : as[i] :: as.drop (i+1) = as.drop i",
"start": [
200,
1
],
"end": [
203,
40
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Fin/Basic.lean",
".lake/packages/lean4/src/lean/Init/GetElem.lean",
".lake/packages/lean4/src/lean/Init/WFTactics.lean",
".lake/packages/lean4/src/lean/Init/Data/Repr.lean"
] | [
{
"full_name": "Array.mkArray",
"code": "@[extern \"lean_mk_array\"]\ndef mkArray {α : Type u} (n : Nat) (v : α) : Array α := {\n data := List.replicate n v\n}",
"start": [
19,
1
],
"end": [
22,
2
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.ofFn",
"code": "def ofFn {n} (f : Fin n → α) : Array α := go 0 (mkEmpty n) where\n \n go (i : Nat) (acc : Array α) : Array α :=\n if h : i < n then go (i+1) (acc.push (f ⟨i, h⟩)) else acc\ntermination_by n - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
24,
1
],
"end": [
34,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.range",
"code": "def range (n : Nat) : Array Nat :=\n n.fold (flip Array.push) (mkEmpty n)",
"start": [
36,
1
],
"end": [
38,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_mkArray",
"code": "@[simp] theorem size_mkArray (n : Nat) (v : α) : (mkArray n v).size = n",
"start": [
40,
1
],
"end": [
41,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.isEmpty",
"code": "@[simp] def isEmpty (a : Array α) : Bool :=\n a.size = 0",
"start": [
47,
1
],
"end": [
48,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.singleton",
"code": "def singleton (v : α) : Array α :=\n mkArray 1 v",
"start": [
50,
1
],
"end": [
51,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.uget",
"code": "@[extern \"lean_array_uget\", simp]\ndef uget (a : @& Array α) (i : USize) (h : i.toNat < a.size) : α :=\n a[i.toNat]",
"start": [
53,
1
],
"end": [
58,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.back",
"code": "def back [Inhabited α] (a : Array α) : α :=\n a.get! (a.size - 1)",
"start": [
63,
1
],
"end": [
64,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.get?",
"code": "def get? (a : Array α) (i : Nat) : Option α :=\n if h : i < a.size then some a[i] else none",
"start": [
66,
1
],
"end": [
67,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.back?",
"code": "def back? (a : Array α) : Option α :=\n a.get? (a.size - 1)",
"start": [
69,
1
],
"end": [
70,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getLit",
"code": "abbrev getLit {α : Type u} {n : Nat} (a : Array α) (i : Nat) (h₁ : a.size = n) (h₂ : i < n) : α :=\n have := h₁.symm ▸ h₂\n a[i]",
"start": [
73,
1
],
"end": [
75,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_set",
"code": "@[simp] theorem size_set (a : Array α) (i : Fin a.size) (v : α) : (set a i v).size = a.size",
"start": [
77,
1
],
"end": [
78,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_push",
"code": "@[simp] theorem size_push (a : Array α) (v : α) : (push a v).size = a.size + 1",
"start": [
80,
1
],
"end": [
81,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.uset",
"code": "@[extern \"lean_array_uset\"]\ndef uset (a : Array α) (i : USize) (v : α) (h : i.toNat < a.size) : Array α :=\n a.set ⟨i.toNat, h⟩ v",
"start": [
83,
1
],
"end": [
88,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.swap",
"code": "@[extern \"lean_array_fswap\"]\ndef swap (a : Array α) (i j : @& Fin a.size) : Array α :=\n let v₁ := a.get i\n let v₂ := a.get j\n let a' := a.set i v₂\n a'.set (size_set a i v₂ ▸ j) v₁",
"start": [
90,
1
],
"end": [
101,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.swap!",
"code": "@[extern \"lean_array_swap\"]\ndef swap! (a : Array α) (i j : @& Nat) : Array α :=\n if h₁ : i < a.size then\n if h₂ : j < a.size then swap a ⟨i, h₁⟩ ⟨j, h₂⟩\n else a\n else a",
"start": [
103,
1
],
"end": [
114,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.swapAt",
"code": "@[inline] def swapAt (a : Array α) (i : Fin a.size) (v : α) : α × Array α :=\n let e := a.get i\n let a := a.set i v\n (e, a)",
"start": [
116,
1
],
"end": [
119,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.swapAt!",
"code": "@[inline]\ndef swapAt! (a : Array α) (i : Nat) (v : α) : α × Array α :=\n if h : i < a.size then\n swapAt a ⟨i, h⟩ v\n else\n have : Inhabited α := ⟨v⟩\n panic! (\"index \" ++ toString i ++ \" out of bounds\")",
"start": [
121,
1
],
"end": [
127,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.pop",
"code": "@[extern \"lean_array_pop\"]\ndef pop (a : Array α) : Array α := {\n data := a.data.dropLast\n}",
"start": [
129,
1
],
"end": [
132,
2
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.shrink",
"code": "def shrink (a : Array α) (n : Nat) : Array α :=\n let rec loop\n | 0, a => a\n | n+1, a => loop n a.pop\n loop (a.size - n) a",
"start": [
134,
1
],
"end": [
138,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.modifyMUnsafe",
"code": "@[inline]\nunsafe def modifyMUnsafe [Monad m] (a : Array α) (i : Nat) (f : α → m α) : m (Array α) := do\n if h : i < a.size then\n let idx : Fin a.size := ⟨i, h⟩\n let v := a.get idx\n let a' := a.set idx (unsafeCast ())\n let v ← f v\n pure <| a'.set (size_set a .. ▸ idx) v\n else\n pure a",
"start": [
140,
1
],
"end": [
152,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.modifyM",
"code": "@[implemented_by modifyMUnsafe]\ndef modifyM [Monad m] (a : Array α) (i : Nat) (f : α → m α) : m (Array α) := do\n if h : i < a.size then\n let idx := ⟨i, h⟩\n let v := a.get idx\n let v ← f v\n pure <| a.set idx v\n else\n pure a",
"start": [
154,
1
],
"end": [
162,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.modify",
"code": "@[inline]\ndef modify (a : Array α) (i : Nat) (f : α → α) : Array α :=\n Id.run <| modifyM a i f",
"start": [
164,
1
],
"end": [
166,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.modifyOp",
"code": "@[inline]\ndef modifyOp (self : Array α) (idx : Nat) (f : α → α) : Array α :=\n self.modify idx f",
"start": [
168,
1
],
"end": [
170,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.forInUnsafe",
"code": "@[inline] unsafe def forInUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (b : β) (f : α → β → m (ForInStep β)) : m β :=\n let sz := USize.ofNat as.size\n let rec @[specialize] loop (i : USize) (b : β) : m β := do\n if i < sz then\n let a := as.uget i lcProof\n match (← f a b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop (i+1) b\n else\n pure b\n loop 0 b",
"start": [
172,
1
],
"end": [
186,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.forIn",
"code": "@[implemented_by Array.forInUnsafe]\nprotected def forIn {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (b : β) (f : α → β → m (ForInStep β)) : m β :=\n let rec loop (i : Nat) (h : i ≤ as.size) (b : β) : m β := do\n match i, h with\n | 0, _ => pure b\n | i+1, h =>\n have h' : i < as.size := Nat.lt_of_lt_of_le (Nat.lt_succ_self i) h\n have : as.size - 1 < as.size := Nat.sub_lt (Nat.zero_lt_of_lt h') (by decide)\n have : as.size - 1 - i < as.size := Nat.lt_of_le_of_lt (Nat.sub_le (as.size - 1) i) this\n match (← f as[as.size - 1 - i] b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop i (Nat.le_of_lt h') b\n loop as.size (Nat.le_refl _) b",
"start": [
188,
1
],
"end": [
201,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldlMUnsafe",
"code": "@[inline]\nunsafe def foldlMUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : β → α → m β) (init : β) (as : Array α) (start := 0) (stop := as.size) : m β :=\n let rec @[specialize] fold (i : USize) (stop : USize) (b : β) : m β := do\n if i == stop then\n pure b\n else\n fold (i+1) stop (← f b (as.uget i lcProof))\n if start < stop then\n if stop ≤ as.size then\n fold (USize.ofNat start) (USize.ofNat stop) init\n else\n pure init\n else\n pure init",
"start": [
206,
1
],
"end": [
220,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldlM",
"code": "@[implemented_by foldlMUnsafe]\ndef foldlM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : β → α → m β) (init : β) (as : Array α) (start := 0) (stop := as.size) : m β :=\n let fold (stop : Nat) (h : stop ≤ as.size) :=\n let rec loop (i : Nat) (j : Nat) (b : β) : m β := do\n if hlt : j < stop then\n match i with\n | 0 => pure b\n | i'+1 =>\n have : j < as.size := Nat.lt_of_lt_of_le hlt h\n loop i' (j+1) (← f b as[j])\n else\n pure b\n loop (stop - start) start init\n if h : stop ≤ as.size then\n fold stop h\n else\n fold as.size (Nat.le_refl _)",
"start": [
222,
1
],
"end": [
239,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldrMUnsafe",
"code": "@[inline]\nunsafe def foldrMUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : α → β → m β) (init : β) (as : Array α) (start := as.size) (stop := 0) : m β :=\n let rec @[specialize] fold (i : USize) (stop : USize) (b : β) : m β := do\n if i == stop then\n pure b\n else\n fold (i-1) stop (← f (as.uget (i-1) lcProof) b)\n if start ≤ as.size then\n if stop < start then\n fold (USize.ofNat start) (USize.ofNat stop) init\n else\n pure init\n else if stop < as.size then\n fold (USize.ofNat as.size) (USize.ofNat stop) init\n else\n pure init",
"start": [
241,
1
],
"end": [
257,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldrM",
"code": "@[implemented_by foldrMUnsafe]\ndef foldrM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : α → β → m β) (init : β) (as : Array α) (start := as.size) (stop := 0) : m β :=\n let rec fold (i : Nat) (h : i ≤ as.size) (b : β) : m β := do\n if i == stop then\n pure b\n else match i, h with\n | 0, _ => pure b\n | i+1, h =>\n have : i < as.size := Nat.lt_of_lt_of_le (Nat.lt_succ_self _) h\n fold i (Nat.le_of_lt this) (← f as[i] b)\n if h : start ≤ as.size then\n if stop < start then\n fold start h init\n else\n pure init\n else if stop < as.size then\n fold as.size (Nat.le_refl _) init\n else\n pure init",
"start": [
259,
1
],
"end": [
278,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapMUnsafe",
"code": "@[inline]\nunsafe def mapMUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : α → m β) (as : Array α) : m (Array β) :=\n let sz := USize.ofNat as.size\n let rec @[specialize] map (i : USize) (r : Array NonScalar) : m (Array PNonScalar.{v}) := do\n if i < sz then\n let v := r.uget i lcProof\n let r := r.uset i default lcProof\n let vNew ← f (unsafeCast v)\n map (i+1) (r.uset i (unsafeCast vNew) lcProof)\n else\n pure (unsafeCast r)\n unsafeCast <| map 0 (unsafeCast as)",
"start": [
280,
1
],
"end": [
295,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapM",
"code": "@[implemented_by mapMUnsafe]\ndef mapM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : α → m β) (as : Array α) : m (Array β) :=\n let rec map (i : Nat) (r : Array β) : m (Array β) := do\n if hlt : i < as.size then\n map (i+1) (r.push (← f as[i]))\n else\n pure r\n termination_by as.size - i\n decreasing_by simp_wf; decreasing_trivial_pre_omega\n map 0 (mkEmpty as.size)",
"start": [
297,
1
],
"end": [
309,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapIdxM",
"code": "@[inline]\ndef mapIdxM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (f : Fin as.size → α → m β) : m (Array β) :=\n let rec @[specialize] map (i : Nat) (j : Nat) (inv : i + j = as.size) (bs : Array β) : m (Array β) := do\n match i, inv with\n | 0, _ => pure bs\n | i+1, inv =>\n have : j < as.size := by\n rw [← inv, Nat.add_assoc, Nat.add_comm 1 j, Nat.add_comm]\n apply Nat.le_add_right\n let idx : Fin as.size := ⟨j, this⟩\n have : i + (j + 1) = as.size := by rw [← inv, Nat.add_comm j 1, Nat.add_assoc]\n map i (j+1) this (bs.push (← f idx (as.get idx)))\n map as.size 0 rfl (mkEmpty as.size)",
"start": [
311,
1
],
"end": [
323,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findSomeM?",
"code": "@[inline]\ndef findSomeM? {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (f : α → m (Option β)) : m (Option β) := do\n for a in as do\n match (← f a) with\n | some b => return b\n | _ => pure ⟨⟩\n return none",
"start": [
325,
1
],
"end": [
331,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findM?",
"code": "@[inline]\ndef findM? {α : Type} {m : Type → Type} [Monad m] (as : Array α) (p : α → m Bool) : m (Option α) := do\n for a in as do\n if (← p a) then\n return a\n return none",
"start": [
333,
1
],
"end": [
338,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findIdxM?",
"code": "@[inline]\ndef findIdxM? [Monad m] (as : Array α) (p : α → m Bool) : m (Option Nat) := do\n let mut i := 0\n for a in as do\n if (← p a) then\n return some i\n i := i + 1\n return none",
"start": [
340,
1
],
"end": [
347,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.anyMUnsafe",
"code": "@[inline]\nunsafe def anyMUnsafe {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) (as : Array α) (start := 0) (stop := as.size) : m Bool :=\n let rec @[specialize] any (i : USize) (stop : USize) : m Bool := do\n if i == stop then\n pure false\n else\n if (← p (as.uget i lcProof)) then\n pure true\n else\n any (i+1) stop\n if start < stop then\n let stop' := min stop as.size\n if start < stop' then\n any (USize.ofNat start) (USize.ofNat stop')\n else\n pure false\n else\n pure false",
"start": [
349,
1
],
"end": [
366,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.anyM",
"code": "@[implemented_by anyMUnsafe]\ndef anyM {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) (as : Array α) (start := 0) (stop := as.size) : m Bool :=\n let any (stop : Nat) (h : stop ≤ as.size) :=\n let rec loop (j : Nat) : m Bool := do\n if hlt : j < stop then\n have : j < as.size := Nat.lt_of_lt_of_le hlt h\n if (← p as[j]) then\n pure true\n else\n loop (j+1)\n else\n pure false\n termination_by stop - j\n decreasing_by simp_wf; decreasing_trivial_pre_omega\n loop start\n if h : stop ≤ as.size then\n any stop h\n else\n any as.size (Nat.le_refl _)",
"start": [
368,
1
],
"end": [
386,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.allM",
"code": "@[inline]\ndef allM {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) (as : Array α) (start := 0) (stop := as.size) : m Bool :=\n return !(← as.anyM (start := start) (stop := stop) fun v => return !(← p v))",
"start": [
388,
1
],
"end": [
390,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findSomeRevM?",
"code": "@[inline]\ndef findSomeRevM? {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Array α) (f : α → m (Option β)) : m (Option β) :=\n let rec @[specialize] find : (i : Nat) → i ≤ as.size → m (Option β)\n | 0, _ => pure none\n | i+1, h => do\n have : i < as.size := Nat.lt_of_lt_of_le (Nat.lt_succ_self _) h\n let r ← f as[i]\n match r with\n | some _ => pure r\n | none =>\n have : i ≤ as.size := Nat.le_of_lt this\n find i this\n find as.size (Nat.le_refl _)",
"start": [
392,
1
],
"end": [
404,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findRevM?",
"code": "@[inline]\ndef findRevM? {α : Type} {m : Type → Type w} [Monad m] (as : Array α) (p : α → m Bool) : m (Option α) :=\n as.findSomeRevM? fun a => return if (← p a) then some a else none",
"start": [
406,
1
],
"end": [
408,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.forM",
"code": "@[inline]\ndef forM {α : Type u} {m : Type v → Type w} [Monad m] (f : α → m PUnit) (as : Array α) (start := 0) (stop := as.size) : m PUnit :=\n as.foldlM (fun _ => f) ⟨⟩ start stop",
"start": [
410,
1
],
"end": [
412,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.forRevM",
"code": "@[inline]\ndef forRevM {α : Type u} {m : Type v → Type w} [Monad m] (f : α → m PUnit) (as : Array α) (start := as.size) (stop := 0) : m PUnit :=\n as.foldrM (fun a _ => f a) ⟨⟩ start stop",
"start": [
414,
1
],
"end": [
416,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldl",
"code": "@[inline]\ndef foldl {α : Type u} {β : Type v} (f : β → α → β) (init : β) (as : Array α) (start := 0) (stop := as.size) : β :=\n Id.run <| as.foldlM f init start stop",
"start": [
418,
1
],
"end": [
420,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.foldr",
"code": "@[inline]\ndef foldr {α : Type u} {β : Type v} (f : α → β → β) (init : β) (as : Array α) (start := as.size) (stop := 0) : β :=\n Id.run <| as.foldrM f init start stop",
"start": [
422,
1
],
"end": [
424,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.map",
"code": "@[inline]\ndef map {α : Type u} {β : Type v} (f : α → β) (as : Array α) : Array β :=\n Id.run <| as.mapM f",
"start": [
426,
1
],
"end": [
428,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapIdx",
"code": "@[inline]\ndef mapIdx {α : Type u} {β : Type v} (as : Array α) (f : Fin as.size → α → β) : Array β :=\n Id.run <| as.mapIdxM f",
"start": [
430,
1
],
"end": [
432,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.zipWithIndex",
"code": "def zipWithIndex (arr : Array α) : Array (α × Nat) :=\n arr.mapIdx fun i a => (a, i)",
"start": [
434,
1
],
"end": [
436,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.find?",
"code": "@[inline]\ndef find? {α : Type} (as : Array α) (p : α → Bool) : Option α :=\n Id.run <| as.findM? p",
"start": [
438,
1
],
"end": [
440,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findSome?",
"code": "@[inline]\ndef findSome? {α : Type u} {β : Type v} (as : Array α) (f : α → Option β) : Option β :=\n Id.run <| as.findSomeM? f",
"start": [
442,
1
],
"end": [
444,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findSome!",
"code": "@[inline]\ndef findSome! {α : Type u} {β : Type v} [Inhabited β] (a : Array α) (f : α → Option β) : β :=\n match findSome? a f with\n | some b => b\n | none => panic! \"failed to find element\"",
"start": [
446,
1
],
"end": [
450,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findSomeRev?",
"code": "@[inline]\ndef findSomeRev? {α : Type u} {β : Type v} (as : Array α) (f : α → Option β) : Option β :=\n Id.run <| as.findSomeRevM? f",
"start": [
452,
1
],
"end": [
454,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findRev?",
"code": "@[inline]\ndef findRev? {α : Type} (as : Array α) (p : α → Bool) : Option α :=\n Id.run <| as.findRevM? p",
"start": [
456,
1
],
"end": [
458,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.findIdx?",
"code": "@[inline]\ndef findIdx? {α : Type u} (as : Array α) (p : α → Bool) : Option Nat :=\n let rec loop (j : Nat) :=\n if h : j < as.size then\n if p as[j] then some j else loop (j + 1)\n else none\n termination_by as.size - j\n decreasing_by simp_wf; decreasing_trivial_pre_omega\n loop 0",
"start": [
460,
1
],
"end": [
468,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getIdx?",
"code": "def getIdx? [BEq α] (a : Array α) (v : α) : Option Nat :=\na.findIdx? fun a => a == v",
"start": [
470,
1
],
"end": [
471,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.any",
"code": "@[inline]\ndef any (as : Array α) (p : α → Bool) (start := 0) (stop := as.size) : Bool :=\n Id.run <| as.anyM p start stop",
"start": [
473,
1
],
"end": [
475,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.all",
"code": "@[inline]\ndef all (as : Array α) (p : α → Bool) (start := 0) (stop := as.size) : Bool :=\n Id.run <| as.allM p start stop",
"start": [
477,
1
],
"end": [
479,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.contains",
"code": "def contains [BEq α] (as : Array α) (a : α) : Bool :=\n as.any (· == a)",
"start": [
481,
1
],
"end": [
482,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.elem",
"code": "def elem [BEq α] (a : α) (as : Array α) : Bool :=\n as.contains a",
"start": [
484,
1
],
"end": [
485,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getEvenElems",
"code": "@[inline] def getEvenElems (as : Array α) : Array α :=\n (·.2) <| as.foldl (init := (true, Array.empty)) fun (even, r) a =>\n if even then\n (false, r.push a)\n else\n (true, r)",
"start": [
487,
1
],
"end": [
492,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toList",
"code": "@[export lean_array_to_list]\ndef toList (as : Array α) : List α :=\n as.foldr List.cons []",
"start": [
494,
1
],
"end": [
499,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toListAppend",
"code": "@[inline]\ndef toListAppend (as : Array α) (l : List α) : List α :=\n as.foldr List.cons l",
"start": [
501,
1
],
"end": [
504,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.append",
"code": "protected def append (as : Array α) (bs : Array α) : Array α :=\n bs.foldl (init := as) fun r v => r.push v",
"start": [
517,
1
],
"end": [
518,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.appendList",
"code": "protected def appendList (as : Array α) (bs : List α) : Array α :=\n bs.foldl (init := as) fun r v => r.push v",
"start": [
522,
1
],
"end": [
523,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.concatMapM",
"code": "@[inline]\ndef concatMapM [Monad m] (f : α → m (Array β)) (as : Array α) : m (Array β) :=\n as.foldlM (init := empty) fun bs a => do return bs ++ (← f a)",
"start": [
527,
1
],
"end": [
529,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.concatMap",
"code": "@[inline]\ndef concatMap (f : α → Array β) (as : Array α) : Array β :=\n as.foldl (init := empty) fun bs a => bs ++ f a",
"start": [
531,
1
],
"end": [
533,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.flatten",
"code": "def flatten (as : Array (Array α)) : Array α :=\n as.foldl (init := empty) fun r a => r ++ a",
"start": [
535,
1
],
"end": [
540,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.isEqvAux",
"code": "@[specialize]\ndef isEqvAux (a b : Array α) (hsz : a.size = b.size) (p : α → α → Bool) (i : Nat) : Bool :=\n if h : i < a.size then\n have : i < b.size := hsz ▸ h\n p a[i] b[i] && isEqvAux a b hsz p (i+1)\n else\n true\ntermination_by a.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
554,
1
],
"end": [
562,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.isEqv",
"code": "@[inline] def isEqv (a b : Array α) (p : α → α → Bool) : Bool :=\n if h : a.size = b.size then\n isEqvAux a b h p 0\n else\n false",
"start": [
564,
1
],
"end": [
568,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filter",
"code": "@[inline]\ndef filter (p : α → Bool) (as : Array α) (start := 0) (stop := as.size) : Array α :=\n as.foldl (init := #[]) (start := start) (stop := stop) fun r a =>\n if p a then r.push a else r",
"start": [
573,
1
],
"end": [
576,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterM",
"code": "@[inline]\ndef filterM [Monad m] (p : α → m Bool) (as : Array α) (start := 0) (stop := as.size) : m (Array α) :=\n as.foldlM (init := #[]) (start := start) (stop := stop) fun r a => do\n if (← p a) then return r.push a else return r",
"start": [
578,
1
],
"end": [
581,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterMapM",
"code": "@[specialize]\ndef filterMapM [Monad m] (f : α → m (Option β)) (as : Array α) (start := 0) (stop := as.size) : m (Array β) :=\n as.foldlM (init := #[]) (start := start) (stop := stop) fun bs a => do\n match (← f a) with\n | some b => pure (bs.push b)\n | none => pure bs",
"start": [
583,
1
],
"end": [
588,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterMap",
"code": "@[inline]\ndef filterMap (f : α → Option β) (as : Array α) (start := 0) (stop := as.size) : Array β :=\n Id.run <| as.filterMapM f (start := start) (stop := stop)",
"start": [
590,
1
],
"end": [
592,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getMax?",
"code": "@[specialize]\ndef getMax? (as : Array α) (lt : α → α → Bool) : Option α :=\n if h : 0 < as.size then\n let a0 := as[0]\n some <| as.foldl (init := a0) (start := 1) fun best a =>\n if lt best a then a else best\n else\n none",
"start": [
594,
1
],
"end": [
601,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.partition",
"code": "@[inline]\ndef partition (p : α → Bool) (as : Array α) : Array α × Array α := Id.run do\n let mut bs := #[]\n let mut cs := #[]\n for a in as do\n if p a then\n bs := bs.push a\n else\n cs := cs.push a\n return (bs, cs)",
"start": [
603,
1
],
"end": [
612,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.ext",
"code": "theorem ext (a b : Array α)\n (h₁ : a.size = b.size)\n (h₂ : (i : Nat) → (hi₁ : i < a.size) → (hi₂ : i < b.size) → a[i] = b[i])\n : a = b",
"start": [
614,
1
],
"end": [
647,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.extLit",
"code": "theorem extLit {n : Nat}\n (a b : Array α)\n (hsz₁ : a.size = n) (hsz₂ : b.size = n)\n (h : (i : Nat) → (hi : i < n) → a.getLit i hsz₁ hi = b.getLit i hsz₂ hi) : a = b",
"start": [
649,
1
],
"end": [
653,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.indexOfAux",
"code": "def indexOfAux [BEq α] (a : Array α) (v : α) (i : Nat) : Option (Fin a.size) :=\n if h : i < a.size then\n let idx : Fin a.size := ⟨i, h⟩;\n if a.get idx == v then some idx\n else indexOfAux a v (i+1)\n else none\ntermination_by a.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
660,
1
],
"end": [
667,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.indexOf?",
"code": "def indexOf? [BEq α] (a : Array α) (v : α) : Option (Fin a.size) :=\n indexOfAux a v 0",
"start": [
669,
1
],
"end": [
670,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_swap",
"code": "@[simp] theorem size_swap (a : Array α) (i j : Fin a.size) : (a.swap i j).size = a.size",
"start": [
672,
1
],
"end": [
674,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_pop",
"code": "@[simp] theorem size_pop (a : Array α) : a.pop.size = a.size - 1",
"start": [
676,
1
],
"end": [
679,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.reverse.termination",
"code": "theorem reverse.termination {i j : Nat} (h : i < j) : j - 1 - (i + 1) < j - i",
"start": [
681,
1
],
"end": [
683,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.reverse",
"code": "def reverse (as : Array α) : Array α :=\n if h : as.size ≤ 1 then\n as\n else\n loop as 0 ⟨as.size - 1, Nat.pred_lt (mt (fun h : as.size = 0 => h ▸ by decide) h)⟩\nwhere\n loop (as : Array α) (i : Nat) (j : Fin as.size) :=\n if h : i < j then\n have := reverse.termination h\n let as := as.swap ⟨i, Nat.lt_trans h j.2⟩ j\n have : j-1 < as.size := by rw [size_swap]; exact Nat.lt_of_le_of_lt (Nat.pred_le _) j.2\n loop as (i+1) ⟨j-1, this⟩\n else\n as\ntermination_by j - i",
"start": [
685,
1
],
"end": [
699,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.popWhile",
"code": "def popWhile (p : α → Bool) (as : Array α) : Array α :=\n if h : as.size > 0 then\n if p (as.get ⟨as.size - 1, Nat.sub_lt h (by decide)⟩) then\n popWhile p as.pop\n else\n as\n else\n as\ntermination_by as.size\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
701,
1
],
"end": [
710,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.takeWhile",
"code": "def takeWhile (p : α → Bool) (as : Array α) : Array α :=\n let rec go (i : Nat) (r : Array α) : Array α :=\n if h : i < as.size then\n let a := as.get ⟨i, h⟩\n if p a then\n go (i+1) (r.push a)\n else\n r\n else\n r\n termination_by as.size - i\n decreasing_by simp_wf; decreasing_trivial_pre_omega\n go 0 #[]",
"start": [
712,
1
],
"end": [
724,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.feraseIdx",
"code": "def feraseIdx (a : Array α) (i : Fin a.size) : Array α :=\n if h : i.val + 1 < a.size then\n let a' := a.swap ⟨i.val + 1, h⟩ i\n let i' : Fin a'.size := ⟨i.val + 1, by simp [a', h]⟩\n a'.feraseIdx i'\n else\n a.pop\ntermination_by a.size - i.val\ndecreasing_by simp_wf; exact Nat.sub_succ_lt_self _ _ i.isLt",
"start": [
726,
1
],
"end": [
738,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.size_feraseIdx",
"code": "theorem size_feraseIdx (a : Array α) (i : Fin a.size) : (a.feraseIdx i).size = a.size - 1",
"start": [
740,
1
],
"end": [
747,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.eraseIdx",
"code": "def eraseIdx (a : Array α) (i : Nat) : Array α :=\n if h : i < a.size then a.feraseIdx ⟨i, h⟩ else a",
"start": [
749,
1
],
"end": [
754,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.erase",
"code": "def erase [BEq α] (as : Array α) (a : α) : Array α :=\n match as.indexOf? a with\n | none => as\n | some i => as.feraseIdx i",
"start": [
756,
1
],
"end": [
759,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.insertAt",
"code": "@[inline] def insertAt (as : Array α) (i : Fin (as.size + 1)) (a : α) : Array α :=\n let rec loop (as : Array α) (j : Fin as.size) :=\n if i.1 < j then\n let j' := ⟨j-1, Nat.lt_of_le_of_lt (Nat.pred_le _) j.2⟩\n let as := as.swap j' j\n loop as ⟨j', by rw [size_swap]; exact j'.2⟩\n else\n as\n termination_by j.1\n decreasing_by simp_wf; decreasing_trivial_pre_omega\n let j := as.size\n let as := as.push a\n loop as ⟨j, size_push .. ▸ j.lt_succ_self⟩",
"start": [
761,
1
],
"end": [
774,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.insertAt!",
"code": "def insertAt! (as : Array α) (i : Nat) (a : α) : Array α :=\n if h : i ≤ as.size then\n insertAt as ⟨i, Nat.lt_succ_of_le h⟩ a\n else panic! \"invalid index\"",
"start": [
776,
1
],
"end": [
780,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toListLitAux",
"code": "def toListLitAux (a : Array α) (n : Nat) (hsz : a.size = n) : ∀ (i : Nat), i ≤ a.size → List α → List α\n | 0, _, acc => acc\n | (i+1), hi, acc => toListLitAux a n hsz i (Nat.le_of_succ_le hi) (a.getLit i hsz (Nat.lt_of_lt_of_eq (Nat.lt_of_lt_of_le (Nat.lt_succ_self i) hi) hsz) :: acc)",
"start": [
782,
1
],
"end": [
784,
162
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toArrayLit",
"code": "def toArrayLit (a : Array α) (n : Nat) (hsz : a.size = n) : Array α :=\n List.toArray <| toListLitAux a n hsz n (hsz ▸ Nat.le_refl _) []",
"start": [
786,
1
],
"end": [
787,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.ext'",
"code": "theorem ext' {as bs : Array α} (h : as.data = bs.data) : as = bs",
"start": [
789,
1
],
"end": [
790,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toArrayAux_eq",
"code": "@[simp] theorem toArrayAux_eq (as : List α) (acc : Array α) : (as.toArrayAux acc).data = acc.data ++ as",
"start": [
792,
1
],
"end": [
793,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.data_toArray",
"code": "theorem data_toArray (as : List α) : as.toArray.data = as",
"start": [
795,
1
],
"end": [
796,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toArrayLit_eq",
"code": "theorem toArrayLit_eq (as : Array α) (n : Nat) (hsz : as.size = n) : as = toArrayLit as n hsz",
"start": [
798,
1
],
"end": [
811,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.isPrefixOfAux",
"code": "def isPrefixOfAux [BEq α] (as bs : Array α) (hle : as.size ≤ bs.size) (i : Nat) : Bool :=\n if h : i < as.size then\n let a := as[i]\n have : i < bs.size := Nat.lt_of_lt_of_le h hle\n let b := bs[i]\n if a == b then\n isPrefixOfAux as bs hle (i+1)\n else\n false\n else\n true\ntermination_by as.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
813,
1
],
"end": [
825,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.isPrefixOf",
"code": "def isPrefixOf [BEq α] (as bs : Array α) : Bool :=\n if h : as.size ≤ bs.size then\n isPrefixOfAux as bs h 0\n else\n false",
"start": [
827,
1
],
"end": [
833,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.allDiffAuxAux",
"code": "private def allDiffAuxAux [BEq α] (as : Array α) (a : α) : forall (i : Nat), i < as.size → Bool\n | 0, _ => true\n | i+1, h =>\n have : i < as.size := Nat.lt_trans (Nat.lt_succ_self _) h;\n a != as[i] && allDiffAuxAux as a i this",
"start": [
835,
1
],
"end": [
839,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.allDiffAux",
"code": "private def allDiffAux [BEq α] (as : Array α) (i : Nat) : Bool :=\n if h : i < as.size then\n allDiffAuxAux as as[i] i h && allDiffAux as (i+1)\n else\n true\ntermination_by as.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
841,
1
],
"end": [
847,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.allDiff",
"code": "def allDiff [BEq α] (as : Array α) : Bool :=\n allDiffAux as 0",
"start": [
849,
1
],
"end": [
850,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.zipWithAux",
"code": "@[specialize] def zipWithAux (f : α → β → γ) (as : Array α) (bs : Array β) (i : Nat) (cs : Array γ) : Array γ :=\n if h : i < as.size then\n let a := as[i]\n if h : i < bs.size then\n let b := bs[i]\n zipWithAux f as bs (i+1) <| cs.push <| f a b\n else\n cs\n else\n cs\ntermination_by as.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
852,
1
],
"end": [
863,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.zipWith",
"code": "@[inline] def zipWith (as : Array α) (bs : Array β) (f : α → β → γ) : Array γ :=\n zipWithAux f as bs 0 #[]",
"start": [
865,
1
],
"end": [
866,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.zip",
"code": "def zip (as : Array α) (bs : Array β) : Array (α × β) :=\n zipWith as bs Prod.mk",
"start": [
868,
1
],
"end": [
869,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.unzip",
"code": "def unzip (as : Array (α × β)) : Array α × Array β :=\n as.foldl (init := (#[], #[])) fun (as, bs) (a, b) => (as.push a, bs.push b)",
"start": [
871,
1
],
"end": [
872,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.split",
"code": "def split (as : Array α) (p : α → Bool) : Array α × Array α :=\n as.foldl (init := (#[], #[])) fun (as, bs) a =>\n if p a then (as.push a, bs) else (as, bs.push a)",
"start": [
874,
1
],
"end": [
876,
53
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Option/BasicAux.lean | [
".lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean",
".lake/packages/lean4/src/lean/Init/Util.lean"
] | [
{
"full_name": "Option.get!",
"code": "@[inline] def get! {α : Type u} [Inhabited α] : Option α → α\n | some x => x\n | none => panic! \"value is none\"",
"start": [
14,
1
],
"end": [
16,
37
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Conv.lean | [
".lake/packages/lean4/src/lean/Init/Tactics.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Array/Subarray.lean | [
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean"
] | [
{
"full_name": "Subarray",
"code": "structure Subarray (α : Type u) where\n array : Array α\n start : Nat\n stop : Nat\n start_le_stop : start ≤ stop\n stop_le_array_size : stop ≤ array.size",
"start": [
11,
1
],
"end": [
16,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.as",
"code": "@[deprecated Subarray.array (since := \"2024-04-13\")]\nabbrev Subarray.as (s : Subarray α) : Array α := s.array",
"start": [
18,
1
],
"end": [
19,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.h₁",
"code": "@[deprecated Subarray.start_le_stop (since := \"2024-04-13\")]\ntheorem Subarray.h₁ (s : Subarray α) : s.start ≤ s.stop",
"start": [
21,
1
],
"end": [
22,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.h₂",
"code": "@[deprecated Subarray.stop_le_array_size (since := \"2024-04-13\")]\ntheorem Subarray.h₂ (s : Subarray α) : s.stop ≤ s.array.size",
"start": [
24,
1
],
"end": [
25,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.size",
"code": "def size (s : Subarray α) : Nat :=\n s.stop - s.start",
"start": [
29,
1
],
"end": [
30,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.size_le_array_size",
"code": "theorem size_le_array_size {s : Subarray α} : s.size ≤ s.array.size",
"start": [
32,
1
],
"end": [
36,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.get",
"code": "def get (s : Subarray α) (i : Fin s.size) : α :=\n have : s.start + i.val < s.array.size := by\n apply Nat.lt_of_lt_of_le _ s.stop_le_array_size\n have := i.isLt\n simp [size] at this\n rw [Nat.add_comm]\n exact Nat.add_lt_of_lt_sub this\n s.array[s.start + i.val]",
"start": [
38,
1
],
"end": [
45,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.getD",
"code": "@[inline] def getD (s : Subarray α) (i : Nat) (v₀ : α) : α :=\n if h : i < s.size then s.get ⟨i, h⟩ else v₀",
"start": [
50,
1
],
"end": [
51,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.get!",
"code": "abbrev get! [Inhabited α] (s : Subarray α) (i : Nat) : α :=\n getD s i default",
"start": [
53,
1
],
"end": [
54,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.popFront",
"code": "def popFront (s : Subarray α) : Subarray α :=\n if h : s.start < s.stop then\n { s with start := s.start + 1, start_le_stop := Nat.le_of_lt_succ (Nat.add_lt_add_right h 1) }\n else\n s",
"start": [
56,
1
],
"end": [
60,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.forInUnsafe",
"code": "@[inline] unsafe def forInUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (s : Subarray α) (b : β) (f : α → β → m (ForInStep β)) : m β :=\n let sz := USize.ofNat s.stop\n let rec @[specialize] loop (i : USize) (b : β) : m β := do\n if i < sz then\n let a := s.array.uget i lcProof\n match (← f a b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop (i+1) b\n else\n pure b\n loop (USize.ofNat s.start) b",
"start": [
62,
1
],
"end": [
72,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.forIn",
"code": "@[implemented_by Subarray.forInUnsafe]\nprotected opaque forIn {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (s : Subarray α) (b : β) (f : α → β → m (ForInStep β)) : m β :=\n pure b",
"start": [
75,
1
],
"end": [
77,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.foldlM",
"code": "@[inline]\ndef foldlM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : β → α → m β) (init : β) (as : Subarray α) : m β :=\n as.array.foldlM f (init := init) (start := as.start) (stop := as.stop)",
"start": [
82,
1
],
"end": [
84,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.foldrM",
"code": "@[inline]\ndef foldrM {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (f : α → β → m β) (init : β) (as : Subarray α) : m β :=\n as.array.foldrM f (init := init) (start := as.stop) (stop := as.start)",
"start": [
86,
1
],
"end": [
88,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.anyM",
"code": "@[inline]\ndef anyM {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) (as : Subarray α) : m Bool :=\n as.array.anyM p (start := as.start) (stop := as.stop)",
"start": [
90,
1
],
"end": [
92,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.allM",
"code": "@[inline]\ndef allM {α : Type u} {m : Type → Type w} [Monad m] (p : α → m Bool) (as : Subarray α) : m Bool :=\n as.array.allM p (start := as.start) (stop := as.stop)",
"start": [
94,
1
],
"end": [
96,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.forM",
"code": "@[inline]\ndef forM {α : Type u} {m : Type v → Type w} [Monad m] (f : α → m PUnit) (as : Subarray α) : m PUnit :=\n as.array.forM f (start := as.start) (stop := as.stop)",
"start": [
98,
1
],
"end": [
100,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.forRevM",
"code": "@[inline]\ndef forRevM {α : Type u} {m : Type v → Type w} [Monad m] (f : α → m PUnit) (as : Subarray α) : m PUnit :=\n as.array.forRevM f (start := as.stop) (stop := as.start)",
"start": [
102,
1
],
"end": [
104,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.foldl",
"code": "@[inline]\ndef foldl {α : Type u} {β : Type v} (f : β → α → β) (init : β) (as : Subarray α) : β :=\n Id.run <| as.foldlM f (init := init)",
"start": [
106,
1
],
"end": [
108,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.foldr",
"code": "@[inline]\ndef foldr {α : Type u} {β : Type v} (f : α → β → β) (init : β) (as : Subarray α) : β :=\n Id.run <| as.foldrM f (init := init)",
"start": [
110,
1
],
"end": [
112,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.any",
"code": "@[inline]\ndef any {α : Type u} (p : α → Bool) (as : Subarray α) : Bool :=\n Id.run <| as.anyM p",
"start": [
114,
1
],
"end": [
116,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.all",
"code": "@[inline]\ndef all {α : Type u} (p : α → Bool) (as : Subarray α) : Bool :=\n Id.run <| as.allM p",
"start": [
118,
1
],
"end": [
120,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.findSomeRevM?",
"code": "@[inline]\ndef findSomeRevM? {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : Subarray α) (f : α → m (Option β)) : m (Option β) :=\n let rec @[specialize] find : (i : Nat) → i ≤ as.size → m (Option β)\n | 0, _ => pure none\n | i+1, h => do\n have : i < as.size := Nat.lt_of_lt_of_le (Nat.lt_succ_self _) h\n let r ← f as[i]\n match r with\n | some _ => pure r\n | none =>\n have : i ≤ as.size := Nat.le_of_lt this\n find i this\n find as.size (Nat.le_refl _)",
"start": [
122,
1
],
"end": [
134,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.findRevM?",
"code": "@[inline]\ndef findRevM? {α : Type} {m : Type → Type w} [Monad m] (as : Subarray α) (p : α → m Bool) : m (Option α) :=\n as.findSomeRevM? fun a => return if (← p a) then some a else none",
"start": [
136,
1
],
"end": [
138,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.findRev?",
"code": "@[inline]\ndef findRev? {α : Type} (as : Subarray α) (p : α → Bool) : Option α :=\n Id.run <| as.findRevM? p",
"start": [
140,
1
],
"end": [
142,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.toSubarray",
"code": "def toSubarray (as : Array α) (start : Nat := 0) (stop : Nat := as.size) : Subarray α :=\n if h₂ : stop ≤ as.size then\n if h₁ : start ≤ stop then\n { array := as, start := start, stop := stop,\n start_le_stop := h₁, stop_le_array_size := h₂ }\n else\n { array := as, start := stop, stop := stop,\n start_le_stop := Nat.le_refl _, stop_le_array_size := h₂ }\n else\n if h₁ : start ≤ as.size then\n { array := as,\n start := start,\n stop := as.size,\n start_le_stop := h₁,\n stop_le_array_size := Nat.le_refl _ }\n else\n { array := as,\n start := as.size,\n stop := as.size,\n start_le_stop := Nat.le_refl _,\n stop_le_array_size := Nat.le_refl _ }",
"start": [
149,
1
],
"end": [
169,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.ofSubarray",
"code": "@[coe]\ndef ofSubarray (s : Subarray α) : Array α := Id.run do\n let mut as := mkEmpty (s.stop - s.start)\n for a in s do\n as := as.push a\n return as",
"start": [
171,
1
],
"end": [
176,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Subarray.toArray",
"code": "def Subarray.toArray (s : Subarray α) : Array α :=\n Array.ofSubarray s",
"start": [
191,
1
],
"end": [
192,
21
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Meta.lean | [
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean",
".lake/packages/lean4/src/lean/Init/MetaTypes.lean",
".lake/packages/lean4/src/lean/Init/Data/Option/BasicAux.lean"
] | [
{
"full_name": "Lean.version.getMajor",
"code": "@[extern \"lean_version_get_major\"]\nprivate opaque version.getMajor (u : Unit) : Nat",
"start": [
15,
1
],
"end": [
16,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.major",
"code": "def version.major : Nat := version.getMajor ()",
"start": [
17,
1
],
"end": [
17,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.getMinor",
"code": "@[extern \"lean_version_get_minor\"]\nprivate opaque version.getMinor (u : Unit) : Nat",
"start": [
19,
1
],
"end": [
20,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.minor",
"code": "def version.minor : Nat := version.getMinor ()",
"start": [
21,
1
],
"end": [
21,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.getPatch",
"code": "@[extern \"lean_version_get_patch\"]\nprivate opaque version.getPatch (u : Unit) : Nat",
"start": [
23,
1
],
"end": [
24,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.patch",
"code": "def version.patch : Nat := version.getPatch ()",
"start": [
25,
1
],
"end": [
25,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.getGithash",
"code": "@[extern \"lean_get_githash\"]\nopaque getGithash (u : Unit) : String",
"start": [
27,
1
],
"end": [
28,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.githash",
"code": "def githash : String := getGithash ()",
"start": [
29,
1
],
"end": [
29,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.getIsRelease",
"code": "@[extern \"lean_version_get_is_release\"]\nopaque version.getIsRelease (u : Unit) : Bool",
"start": [
31,
1
],
"end": [
32,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.isRelease",
"code": "def version.isRelease : Bool := version.getIsRelease ()",
"start": [
33,
1
],
"end": [
33,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.getSpecialDesc",
"code": "@[extern \"lean_version_get_special_desc\"]\nopaque version.getSpecialDesc (u : Unit) : String",
"start": [
35,
1
],
"end": [
37,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.version.specialDesc",
"code": "def version.specialDesc : String := version.getSpecialDesc ()",
"start": [
38,
1
],
"end": [
38,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.versionStringCore",
"code": "def versionStringCore :=\n toString version.major ++ \".\" ++ toString version.minor ++ \".\" ++ toString version.patch",
"start": [
40,
1
],
"end": [
41,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.versionString",
"code": "def versionString :=\n if version.specialDesc ≠ \"\" then\n versionStringCore ++ \"-\" ++ version.specialDesc\n else if version.isRelease then\n versionStringCore\n else\n versionStringCore ++ \", commit \" ++ githash",
"start": [
43,
1
],
"end": [
49,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.origin",
"code": "def origin :=\n \"leanprover/lean4\"",
"start": [
51,
1
],
"end": [
52,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.toolchain",
"code": "def toolchain :=\n if version.specialDesc ≠ \"\" then\n if version.isRelease then\n origin ++ \":\" ++ versionStringCore ++ \"-\" ++ version.specialDesc\n else\n origin ++ \":\" ++ version.specialDesc\n else if version.isRelease then\n origin ++ \":\" ++ versionStringCore\n else\n \"\"",
"start": [
54,
1
],
"end": [
63,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Internal.isStage0",
"code": "@[extern \"lean_internal_is_stage0\"]\nopaque Internal.isStage0 (u : Unit) : Bool",
"start": [
65,
1
],
"end": [
66,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Internal.hasLLVMBackend",
"code": "@[extern \"lean_internal_has_llvm_backend\"]\nopaque Internal.hasLLVMBackend (u : Unit) : Bool",
"start": [
68,
1
],
"end": [
75,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isGreek",
"code": "def isGreek (c : Char) : Bool :=\n 0x391 ≤ c.val && c.val ≤ 0x3dd",
"start": [
77,
1
],
"end": [
79,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isLetterLike",
"code": "def isLetterLike (c : Char) : Bool :=\n (0x3b1 ≤ c.val && c.val ≤ 0x3c9 && c.val ≠ 0x3bb) || (0x391 ≤ c.val && c.val ≤ 0x3A9 && c.val ≠ 0x3A0 && c.val ≠ 0x3A3) || (0x3ca ≤ c.val && c.val ≤ 0x3fb) || (0x1f00 ≤ c.val && c.val ≤ 0x1ffe) || (0x2100 ≤ c.val && c.val ≤ 0x214f) || (0x1d49c ≤ c.val && c.val ≤ 0x1d59f)",
"start": [
81,
1
],
"end": [
87,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isNumericSubscript",
"code": "def isNumericSubscript (c : Char) : Bool :=\n 0x2080 ≤ c.val && c.val ≤ 0x2089",
"start": [
89,
1
],
"end": [
90,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isSubScriptAlnum",
"code": "def isSubScriptAlnum (c : Char) : Bool :=\n isNumericSubscript c ||\n (0x2090 ≤ c.val && c.val ≤ 0x209c) ||\n (0x1d62 ≤ c.val && c.val ≤ 0x1d6a)",
"start": [
92,
1
],
"end": [
95,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isIdFirst",
"code": "def isIdFirst (c : Char) : Bool :=\n c.isAlpha || c = '_' || isLetterLike c",
"start": [
97,
1
],
"end": [
98,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isIdRest",
"code": "def isIdRest (c : Char) : Bool :=\n c.isAlphanum || c = '_' || c = '\\'' || c == '!' || c == '?' || isLetterLike c || isSubScriptAlnum c",
"start": [
100,
1
],
"end": [
101,
102
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.idBeginEscape",
"code": "def idBeginEscape := '«'",
"start": [
103,
1
],
"end": [
103,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.idEndEscape",
"code": "def idEndEscape := '»'",
"start": [
104,
1
],
"end": [
104,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isIdBeginEscape",
"code": "def isIdBeginEscape (c : Char) : Bool := c = idBeginEscape",
"start": [
105,
1
],
"end": [
105,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.isIdEndEscape",
"code": "def isIdEndEscape (c : Char) : Bool := c = idEndEscape",
"start": [
106,
1
],
"end": [
106,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.getRoot",
"code": "def getRoot : Name → Name\n | anonymous => anonymous\n | n@(str anonymous _) => n\n | n@(num anonymous _) => n\n | str n _ => getRoot n\n | num n _ => getRoot n",
"start": [
109,
1
],
"end": [
114,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isInaccessibleUserName",
"code": "@[export lean_is_inaccessible_user_name]\ndef isInaccessibleUserName : Name → Bool\n | Name.str _ s => s.contains '✝' || s == \"_inaccessible\"\n | Name.num p _ => isInaccessibleUserName p\n | _ => false",
"start": [
116,
1
],
"end": [
120,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.escapePart",
"code": "def escapePart (s : String) : Option String :=\n if s.length > 0 && isIdFirst (s.get 0) && (s.toSubstring.drop 1).all isIdRest then s\n else if s.any isIdEndEscape then none\n else some <| idBeginEscape.toString ++ s ++ idEndEscape.toString",
"start": [
122,
1
],
"end": [
125,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.toStringWithSep",
"code": "def toStringWithSep : Name → String\n | anonymous => \"[anonymous]\"\n | str anonymous s => maybeEscape s\n | num anonymous v => toString v\n | str n s => toStringWithSep n ++ sep ++ maybeEscape s\n | num n v => toStringWithSep n ++ sep ++ Nat.repr v\nwhere\n maybeEscape s := if escape then escapePart s |>.getD s else s",
"start": [
129,
1
],
"end": [
136,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.toString",
"code": "protected def toString (n : Name) (escape := true) : String :=\n toStringWithSep \".\" (escape && !n.isInaccessibleUserName && !n.hasMacroScopes && !maybePseudoSyntax) n\nwhere\n maybePseudoSyntax :=\n if let .str _ s := n.getRoot then\n \"#\".isPrefixOf s || \"?\".isPrefixOf s\n else\n false",
"start": [
138,
1
],
"end": [
147,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.hasNum",
"code": "private def hasNum : Name → Bool\n | anonymous => false\n | num .. => true\n | str p .. => hasNum p",
"start": [
152,
1
],
"end": [
155,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.reprPrec",
"code": "protected def reprPrec (n : Name) (prec : Nat) : Std.Format :=\n match n with\n | anonymous => Std.Format.text \"Lean.Name.anonymous\"\n | num p i => Repr.addAppParen (\"Lean.Name.mkNum \" ++ Name.reprPrec p max_prec ++ \" \" ++ repr i) prec\n | str p s =>\n if p.hasNum then\n Repr.addAppParen (\"Lean.Name.mkStr \" ++ Name.reprPrec p max_prec ++ \" \" ++ repr s) prec\n else\n Std.Format.text \"`\" ++ n.toString",
"start": [
157,
1
],
"end": [
165,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.capitalize",
"code": "def capitalize : Name → Name\n | .str p s => .str p s.capitalize\n | n => n",
"start": [
170,
1
],
"end": [
172,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.replacePrefix",
"code": "def replacePrefix : Name → Name → Name → Name\n | anonymous, anonymous, newP => newP\n | anonymous, _, _ => anonymous\n | n@(str p s), queryP, newP => if n == queryP then newP else Name.mkStr (p.replacePrefix queryP newP) s\n | n@(num p s), queryP, newP => if n == queryP then newP else Name.mkNum (p.replacePrefix queryP newP) s",
"start": [
174,
1
],
"end": [
178,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.eraseSuffix?",
"code": "def eraseSuffix? : Name → Name → Option Name\n | n, anonymous => some n\n | str p s, str p' s' => if s == s' then eraseSuffix? p p' else none\n | num p s, num p' s' => if s == s' then eraseSuffix? p p' else none\n | _, _ => none",
"start": [
180,
1
],
"end": [
187,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.modifyBase",
"code": "@[inline] def modifyBase (n : Name) (f : Name → Name) : Name :=\n if n.hasMacroScopes then\n let view := extractMacroScopes n\n { view with name := f view.name }.review\n else\n f n",
"start": [
189,
1
],
"end": [
195,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.appendAfter",
"code": "@[export lean_name_append_after]\ndef appendAfter (n : Name) (suffix : String) : Name :=\n n.modifyBase fun\n | str p s => Name.mkStr p (s ++ suffix)\n | n => Name.mkStr n suffix",
"start": [
197,
1
],
"end": [
201,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.appendIndexAfter",
"code": "@[export lean_name_append_index_after]\ndef appendIndexAfter (n : Name) (idx : Nat) : Name :=\n n.modifyBase fun\n | str p s => Name.mkStr p (s ++ \"_\" ++ toString idx)\n | n => Name.mkStr n (\"_\" ++ toString idx)",
"start": [
203,
1
],
"end": [
207,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.appendBefore",
"code": "@[export lean_name_append_before]\ndef appendBefore (n : Name) (pre : String) : Name :=\n n.modifyBase fun\n | anonymous => Name.mkStr anonymous pre\n | str p s => Name.mkStr p (pre ++ s)\n | num p n => Name.mkNum (Name.mkStr p pre) n",
"start": [
209,
1
],
"end": [
214,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.beq_iff_eq",
"code": "protected theorem beq_iff_eq {m n : Name} : m == n ↔ m = n",
"start": [
216,
1
],
"end": [
218,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.NameGenerator.curr",
"code": "@[inline] def curr (g : NameGenerator) : Name :=\n Name.mkNum g.namePrefix g.idx",
"start": [
231,
1
],
"end": [
232,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.NameGenerator.next",
"code": "@[inline] def next (g : NameGenerator) : NameGenerator :=\n { g with idx := g.idx + 1 }",
"start": [
234,
1
],
"end": [
235,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.NameGenerator.mkChild",
"code": "@[inline] def mkChild (g : NameGenerator) : NameGenerator × NameGenerator :=\n ({ namePrefix := Name.mkNum g.namePrefix g.idx, idx := 1 },\n { g with idx := g.idx + 1 })",
"start": [
237,
1
],
"end": [
239,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.MonadNameGenerator",
"code": "class MonadNameGenerator (m : Type → Type) where\n getNGen : m NameGenerator\n setNGen : NameGenerator → m Unit",
"start": [
243,
1
],
"end": [
245,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkFreshId",
"code": "def mkFreshId {m : Type → Type} [Monad m] [MonadNameGenerator m] : m Name := do\n let ngen ← getNGen\n let r := ngen.curr\n setNGen ngen.next\n pure r",
"start": [
249,
1
],
"end": [
253,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.monadNameGeneratorLift",
"code": "instance monadNameGeneratorLift (m n : Type → Type) [MonadLift m n] [MonadNameGenerator m] : MonadNameGenerator n := {\n getNGen := liftM (getNGen : m _),\n setNGen := fun ngen => liftM (setNGen ngen : m _)\n}",
"start": [
255,
1
],
"end": [
258,
2
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Term",
"code": "abbrev Term := TSyntax `term",
"start": [
266,
1
],
"end": [
266,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Command",
"code": "abbrev Command := TSyntax `command",
"start": [
267,
1
],
"end": [
267,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Level",
"code": "protected abbrev Level := TSyntax `level",
"start": [
268,
1
],
"end": [
268,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Tactic",
"code": "protected abbrev Tactic := TSyntax `tactic",
"start": [
269,
1
],
"end": [
269,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Prec",
"code": "abbrev Prec := TSyntax `prec",
"start": [
270,
1
],
"end": [
270,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Prio",
"code": "abbrev Prio := TSyntax `prio",
"start": [
271,
1
],
"end": [
271,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.Ident",
"code": "abbrev Ident := TSyntax identKind",
"start": [
272,
1
],
"end": [
272,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.StrLit",
"code": "abbrev StrLit := TSyntax strLitKind",
"start": [
273,
1
],
"end": [
273,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.CharLit",
"code": "abbrev CharLit := TSyntax charLitKind",
"start": [
274,
1
],
"end": [
274,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.NameLit",
"code": "abbrev NameLit := TSyntax nameLitKind",
"start": [
275,
1
],
"end": [
275,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.ScientificLit",
"code": "abbrev ScientificLit := TSyntax scientificLitKind",
"start": [
276,
1
],
"end": [
276,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.NumLit",
"code": "abbrev NumLit := TSyntax numLitKind",
"start": [
277,
1
],
"end": [
277,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.HygieneInfo",
"code": "abbrev HygieneInfo := TSyntax hygieneInfoKind",
"start": [
278,
1
],
"end": [
278,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.structEq",
"code": "partial def structEq : Syntax → Syntax → Bool\n | Syntax.missing, Syntax.missing => true\n | Syntax.node _ k args, Syntax.node _ k' args' => k == k' && args.isEqv args' structEq\n | Syntax.atom _ val, Syntax.atom _ val' => val == val'\n | Syntax.ident _ rawVal val preresolved, Syntax.ident _ rawVal' val' preresolved' => rawVal == rawVal' && val == val' && preresolved == preresolved'\n | _, _ => false",
"start": [
338,
1
],
"end": [
344,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getTailInfo?",
"code": "partial def getTailInfo? : Syntax → Option SourceInfo\n | atom info _ => info\n | ident info .. => info\n | node SourceInfo.none _ args =>\n args.findSomeRev? getTailInfo?\n | node info _ _ => info\n | _ => none",
"start": [
349,
1
],
"end": [
355,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getTailInfo",
"code": "def getTailInfo (stx : Syntax) : SourceInfo :=\n stx.getTailInfo?.getD SourceInfo.none",
"start": [
357,
1
],
"end": [
358,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getTrailingSize",
"code": "def getTrailingSize (stx : Syntax) : Nat :=\n match stx.getTailInfo? with\n | some (SourceInfo.original (trailing := trailing) ..) => trailing.bsize\n | _ => 0",
"start": [
360,
1
],
"end": [
363,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getSubstring?",
"code": "def getSubstring? (stx : Syntax) (withLeading := true) (withTrailing := true) : Option Substring :=\n match stx.getHeadInfo, stx.getTailInfo with\n | SourceInfo.original lead startPos _ _, SourceInfo.original _ _ trail stopPos =>\n some {\n str := lead.str\n startPos := if withLeading then lead.startPos else startPos\n stopPos := if withTrailing then trail.stopPos else stopPos\n }\n | _, _ => none",
"start": [
365,
1
],
"end": [
376,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.updateLast",
"code": "@[specialize] private partial def updateLast {α} [Inhabited α] (a : Array α) (f : α → Option α) (i : Nat) : Option (Array α) :=\n if i == 0 then\n none\n else\n let i := i - 1\n let v := a[i]!\n match f v with\n | some v => some <| a.set! i v\n | none => updateLast a f i",
"start": [
378,
1
],
"end": [
386,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setTailInfoAux",
"code": "partial def setTailInfoAux (info : SourceInfo) : Syntax → Option Syntax\n | atom _ val => some <| atom info val\n | ident _ rawVal val pre => some <| ident info rawVal val pre\n | node info k args =>\n match updateLast args (setTailInfoAux info) args.size with\n | some args => some <| node info k args\n | none => none\n | _ => none",
"start": [
388,
1
],
"end": [
395,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setTailInfo",
"code": "def setTailInfo (stx : Syntax) (info : SourceInfo) : Syntax :=\n match setTailInfoAux info stx with\n | some stx => stx\n | none => stx",
"start": [
397,
1
],
"end": [
400,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.unsetTrailing",
"code": "def unsetTrailing (stx : Syntax) : Syntax :=\n match stx.getTailInfo with\n | SourceInfo.original lead pos _ endPos => stx.setTailInfo (SourceInfo.original lead pos \"\".toSubstring endPos)\n | _ => stx",
"start": [
402,
1
],
"end": [
405,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.updateFirst",
"code": "@[specialize] private partial def updateFirst {α} [Inhabited α] (a : Array α) (f : α → Option α) (i : Nat) : Option (Array α) :=\n if h : i < a.size then\n let v := a[i]\n match f v with\n | some v => some <| a.set ⟨i, h⟩ v\n | none => updateFirst a f (i+1)\n else\n none",
"start": [
407,
1
],
"end": [
414,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setHeadInfoAux",
"code": "partial def setHeadInfoAux (info : SourceInfo) : Syntax → Option Syntax\n | atom _ val => some <| atom info val\n | ident _ rawVal val pre => some <| ident info rawVal val pre\n | node i k args =>\n match updateFirst args (setHeadInfoAux info) 0 with\n | some args => some <| node i k args\n | _ => none\n | _ => none",
"start": [
416,
1
],
"end": [
423,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setHeadInfo",
"code": "def setHeadInfo (stx : Syntax) (info : SourceInfo) : Syntax :=\n match setHeadInfoAux info stx with\n | some stx => stx\n | none => stx",
"start": [
425,
1
],
"end": [
428,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.setInfo",
"code": "def setInfo (info : SourceInfo) : Syntax → Syntax\n | atom _ val => atom info val\n | ident _ rawVal val pre => ident info rawVal val pre\n | node _ kind args => node info kind args\n | missing => missing",
"start": [
430,
1
],
"end": [
434,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getHead?",
"code": "partial def getHead? : Syntax → Option Syntax\n | stx@(atom info ..) => info.getPos?.map fun _ => stx\n | stx@(ident info ..) => info.getPos?.map fun _ => stx\n | node SourceInfo.none _ args => args.findSome? getHead?\n | stx@(node ..) => stx\n | _ => none",
"start": [
436,
1
],
"end": [
442,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.copyHeadTailInfoFrom",
"code": "def copyHeadTailInfoFrom (target source : Syntax) : Syntax :=\n target.setHeadInfo source.getHeadInfo |>.setTailInfo source.getTailInfo",
"start": [
444,
1
],
"end": [
445,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkSynthetic",
"code": "def mkSynthetic (stx : Syntax) : Syntax :=\n stx.setHeadInfo (SourceInfo.fromRef stx)",
"start": [
447,
1
],
"end": [
449,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.withHeadRefOnly",
"code": "@[inline] def withHeadRefOnly {m : Type → Type} [Monad m] [MonadRef m] {α} (x : m α) : m α := do\n match (← getRef).getHead? with\n | none => x\n | some ref => withRef ref x",
"start": [
453,
1
],
"end": [
457,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.expandMacros",
"code": "partial def expandMacros (stx : Syntax) (p : SyntaxNodeKind → Bool := fun k => k != `Lean.Parser.Term.byTactic) : MacroM Syntax :=\n withRef stx do\n match stx with\n | .node info k args => do\n if p k then\n match (← expandMacro? stx) with\n | some stxNew => expandMacros stxNew\n | none => do\n let args ← Macro.withIncRecDepth stx <| args.mapM expandMacros\n return .node info k args\n else\n return stx\n | stx => return stx",
"start": [
459,
1
],
"end": [
496,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkIdentFrom",
"code": "def mkIdentFrom (src : Syntax) (val : Name) (canonical := false) : Ident :=\n ⟨Syntax.ident (SourceInfo.fromRef src canonical) (toString val).toSubstring val []⟩",
"start": [
500,
1
],
"end": [
504,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkIdentFromRef",
"code": "def mkIdentFromRef [Monad m] [MonadRef m] (val : Name) (canonical := false) : m Ident := do\n return mkIdentFrom (← getRef) val canonical",
"start": [
506,
1
],
"end": [
507,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkCIdentFrom",
"code": "def mkCIdentFrom (src : Syntax) (c : Name) (canonical := false) : Ident :=\n let id := addMacroScope `_internal c reservedMacroScope\n ⟨Syntax.ident (SourceInfo.fromRef src canonical) (toString id).toSubstring id [.decl c []]⟩",
"start": [
509,
1
],
"end": [
516,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkCIdentFromRef",
"code": "def mkCIdentFromRef [Monad m] [MonadRef m] (c : Name) (canonical := false) : m Syntax := do\n return mkCIdentFrom (← getRef) c canonical",
"start": [
518,
1
],
"end": [
519,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkCIdent",
"code": "def mkCIdent (c : Name) : Ident :=\n mkCIdentFrom Syntax.missing c",
"start": [
521,
1
],
"end": [
522,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkIdent",
"code": "@[export lean_mk_syntax_ident]\ndef mkIdent (val : Name) : Ident :=\n ⟨Syntax.ident SourceInfo.none (toString val).toSubstring val []⟩",
"start": [
524,
1
],
"end": [
526,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkGroupNode",
"code": "@[inline] def mkGroupNode (args : Array Syntax := #[]) : Syntax :=\n mkNode groupKind args",
"start": [
528,
1
],
"end": [
529,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkSepArray",
"code": "def mkSepArray (as : Array Syntax) (sep : Syntax) : Array Syntax := Id.run do\n let mut i := 0\n let mut r := #[]\n for a in as do\n if i > 0 then\n r := r.push sep |>.push a\n else\n r := r.push a\n i := i + 1\n return r",
"start": [
531,
1
],
"end": [
540,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkOptionalNode",
"code": "def mkOptionalNode (arg : Option Syntax) : Syntax :=\n match arg with\n | some arg => mkNullNode #[arg]\n | none => mkNullNode #[]",
"start": [
542,
1
],
"end": [
545,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkHole",
"code": "def mkHole (ref : Syntax) (canonical := false) : Syntax :=\n mkNode `Lean.Parser.Term.hole #[mkAtomFrom ref \"_\" canonical]",
"start": [
547,
1
],
"end": [
548,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkSep",
"code": "def mkSep (a : Array Syntax) (sep : Syntax) : Syntax :=\n mkNullNode <| mkSepArray a sep",
"start": [
552,
1
],
"end": [
553,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.SepArray.ofElems",
"code": "def SepArray.ofElems {sep} (elems : Array Syntax) : SepArray sep :=\n⟨mkSepArray elems (if sep.isEmpty then mkNullNode else mkAtom sep)⟩",
"start": [
555,
1
],
"end": [
556,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.SepArray.ofElemsUsingRef",
"code": "def SepArray.ofElemsUsingRef [Monad m] [MonadRef m] {sep} (elems : Array Syntax) : m (SepArray sep) := do\n let ref ← getRef;\n return ⟨mkSepArray elems (if sep.isEmpty then mkNullNode else mkAtomFrom ref sep)⟩",
"start": [
558,
1
],
"end": [
560,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.TSepArray.ofElems",
"code": "def TSepArray.ofElems {sep} (elems : Array (TSyntax k)) : TSepArray k sep :=\n .mk (SepArray.ofElems (sep := sep) (TSyntaxArray.raw elems)).1",
"start": [
565,
1
],
"end": [
572,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkApp",
"code": "def mkApp (fn : Term) : (args : TSyntaxArray `term) → Term\n | #[] => fn\n | args => ⟨mkNode `Lean.Parser.Term.app #[fn, mkNullNode args.raw]⟩",
"start": [
577,
1
],
"end": [
580,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkCApp",
"code": "def mkCApp (fn : Name) (args : TSyntaxArray `term) : Term :=\n mkApp (mkCIdent fn) args",
"start": [
582,
1
],
"end": [
583,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkLit",
"code": "def mkLit (kind : SyntaxNodeKind) (val : String) (info := SourceInfo.none) : TSyntax kind :=\n let atom : Syntax := Syntax.atom info val\n mkNode kind #[atom]",
"start": [
585,
1
],
"end": [
587,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkCharLit",
"code": "def mkCharLit (val : Char) (info := SourceInfo.none) : CharLit :=\n mkLit charLitKind (Char.quote val) info",
"start": [
589,
1
],
"end": [
590,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkStrLit",
"code": "def mkStrLit (val : String) (info := SourceInfo.none) : StrLit :=\n mkLit strLitKind (String.quote val) info",
"start": [
592,
1
],
"end": [
593,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkNumLit",
"code": "def mkNumLit (val : String) (info := SourceInfo.none) : NumLit :=\n mkLit numLitKind val info",
"start": [
595,
1
],
"end": [
596,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkScientificLit",
"code": "def mkScientificLit (val : String) (info := SourceInfo.none) : TSyntax scientificLitKind :=\n mkLit scientificLitKind val info",
"start": [
598,
1
],
"end": [
599,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.mkNameLit",
"code": "def mkNameLit (val : String) (info := SourceInfo.none) : NameLit :=\n mkLit nameLitKind val info",
"start": [
601,
1
],
"end": [
602,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeBinLitAux",
"code": "private partial def decodeBinLitAux (s : String) (i : String.Pos) (val : Nat) : Option Nat :=\n if s.atEnd i then some val\n else\n let c := s.get i\n if c == '0' then decodeBinLitAux s (s.next i) (2*val)\n else if c == '1' then decodeBinLitAux s (s.next i) (2*val + 1)\n else none",
"start": [
611,
1
],
"end": [
617,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeOctalLitAux",
"code": "private partial def decodeOctalLitAux (s : String) (i : String.Pos) (val : Nat) : Option Nat :=\n if s.atEnd i then some val\n else\n let c := s.get i\n if '0' ≤ c && c ≤ '7' then decodeOctalLitAux s (s.next i) (8*val + c.toNat - '0'.toNat)\n else none",
"start": [
619,
1
],
"end": [
624,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeHexDigit",
"code": "private def decodeHexDigit (s : String) (i : String.Pos) : Option (Nat × String.Pos) :=\n let c := s.get i\n let i := s.next i\n if '0' ≤ c && c ≤ '9' then some (c.toNat - '0'.toNat, i)\n else if 'a' ≤ c && c ≤ 'f' then some (10 + c.toNat - 'a'.toNat, i)\n else if 'A' ≤ c && c ≤ 'F' then some (10 + c.toNat - 'A'.toNat, i)\n else none",
"start": [
626,
1
],
"end": [
632,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeHexLitAux",
"code": "private partial def decodeHexLitAux (s : String) (i : String.Pos) (val : Nat) : Option Nat :=\n if s.atEnd i then some val\n else match decodeHexDigit s i with\n | some (d, i) => decodeHexLitAux s i (16*val + d)\n | none => none",
"start": [
634,
1
],
"end": [
638,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeDecimalLitAux",
"code": "private partial def decodeDecimalLitAux (s : String) (i : String.Pos) (val : Nat) : Option Nat :=\n if s.atEnd i then some val\n else\n let c := s.get i\n if '0' ≤ c && c ≤ '9' then decodeDecimalLitAux s (s.next i) (10*val + c.toNat - '0'.toNat)\n else none",
"start": [
640,
1
],
"end": [
645,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeNatLitVal?",
"code": "def decodeNatLitVal? (s : String) : Option Nat :=\n let len := s.length\n if len == 0 then none\n else\n let c := s.get 0\n if c == '0' then\n if len == 1 then some 0\n else\n let c := s.get ⟨1⟩\n if c == 'x' || c == 'X' then decodeHexLitAux s ⟨2⟩ 0\n else if c == 'b' || c == 'B' then decodeBinLitAux s ⟨2⟩ 0\n else if c == 'o' || c == 'O' then decodeOctalLitAux s ⟨2⟩ 0\n else if c.isDigit then decodeDecimalLitAux s 0 0\n else none\n else if c.isDigit then decodeDecimalLitAux s 0 0\n else none",
"start": [
647,
1
],
"end": [
662,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isLit?",
"code": "def isLit? (litKind : SyntaxNodeKind) (stx : Syntax) : Option String :=\n match stx with\n | Syntax.node _ k args =>\n if k == litKind && args.size == 1 then\n match args.get! 0 with\n | (Syntax.atom _ val) => some val\n | _ => none\n else\n none\n | _ => none",
"start": [
664,
1
],
"end": [
673,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isNatLitAux",
"code": "private def isNatLitAux (litKind : SyntaxNodeKind) (stx : Syntax) : Option Nat :=\n match isLit? litKind stx with\n | some val => decodeNatLitVal? val\n | _ => none",
"start": [
675,
1
],
"end": [
678,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isNatLit?",
"code": "def isNatLit? (s : Syntax) : Option Nat :=\n isNatLitAux numLitKind s",
"start": [
680,
1
],
"end": [
681,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isFieldIdx?",
"code": "def isFieldIdx? (s : Syntax) : Option Nat :=\n isNatLitAux fieldIdxKind s",
"start": [
683,
1
],
"end": [
684,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeScientificLitVal?",
"code": "partial def decodeScientificLitVal? (s : String) : Option (Nat × Bool × Nat) :=\n let len := s.length\n if len == 0 then none\n else\n let c := s.get 0\n if c.isDigit then\n decode 0 0\n else none\nwhere\n decodeAfterExp (i : String.Pos) (val : Nat) (e : Nat) (sign : Bool) (exp : Nat) : Option (Nat × Bool × Nat) :=\n if s.atEnd i then\n if sign then\n some (val, sign, exp + e)\n else if exp >= e then\n some (val, sign, exp - e)\n else\n some (val, true, e - exp)\n else\n let c := s.get i\n if '0' ≤ c && c ≤ '9' then\n decodeAfterExp (s.next i) val e sign (10*exp + c.toNat - '0'.toNat)\n else\n none\n\n decodeExp (i : String.Pos) (val : Nat) (e : Nat) : Option (Nat × Bool × Nat) :=\n if s.atEnd i then none else\n let c := s.get i\n if c == '-' then\n decodeAfterExp (s.next i) val e true 0\n else if c == '+' then\n decodeAfterExp (s.next i) val e false 0\n else\n decodeAfterExp i val e false 0\n\n decodeAfterDot (i : String.Pos) (val : Nat) (e : Nat) : Option (Nat × Bool × Nat) :=\n if s.atEnd i then\n some (val, true, e)\n else\n let c := s.get i\n if '0' ≤ c && c ≤ '9' then\n decodeAfterDot (s.next i) (10*val + c.toNat - '0'.toNat) (e+1)\n else if c == 'e' || c == 'E' then\n decodeExp (s.next i) val e\n else\n none\n\n decode (i : String.Pos) (val : Nat) : Option (Nat × Bool × Nat) :=\n if s.atEnd i then\n none\n else\n let c := s.get i\n if '0' ≤ c && c ≤ '9' then\n decode (s.next i) (10*val + c.toNat - '0'.toNat)\n else if c == '.' then\n decodeAfterDot (s.next i) val 0\n else if c == 'e' || c == 'E' then\n decodeExp (s.next i) val 0\n else\n none",
"start": [
686,
1
],
"end": [
748,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isScientificLit?",
"code": "def isScientificLit? (stx : Syntax) : Option (Nat × Bool × Nat) :=\n match isLit? scientificLitKind stx with\n | some val => decodeScientificLitVal? val\n | _ => none",
"start": [
750,
1
],
"end": [
753,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isIdOrAtom?",
"code": "def isIdOrAtom? : Syntax → Option String\n | Syntax.atom _ val => some val\n | Syntax.ident _ rawVal _ _ => some rawVal.toString\n | _ => none",
"start": [
755,
1
],
"end": [
758,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.toNat",
"code": "def toNat (stx : Syntax) : Nat :=\n match stx.isNatLit? with\n | some val => val\n | none => 0",
"start": [
760,
1
],
"end": [
763,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeQuotedChar",
"code": "def decodeQuotedChar (s : String) (i : String.Pos) : Option (Char × String.Pos) := do\n let c := s.get i\n let i := s.next i\n if c == '\\\\' then pure ('\\\\', i)\n else if c = '\\\"' then pure ('\\\"', i)\n else if c = '\\'' then pure ('\\'', i)\n else if c = 'r' then pure ('\\r', i)\n else if c = 'n' then pure ('\\n', i)\n else if c = 't' then pure ('\\t', i)\n else if c = 'x' then\n let (d₁, i) ← decodeHexDigit s i\n let (d₂, i) ← decodeHexDigit s i\n pure (Char.ofNat (16*d₁ + d₂), i)\n else if c = 'u' then do\n let (d₁, i) ← decodeHexDigit s i\n let (d₂, i) ← decodeHexDigit s i\n let (d₃, i) ← decodeHexDigit s i\n let (d₄, i) ← decodeHexDigit s i\n pure (Char.ofNat (16*(16*(16*d₁ + d₂) + d₃) + d₄), i)\n else\n none",
"start": [
765,
1
],
"end": [
785,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeStringGap",
"code": "def decodeStringGap (s : String) (i : String.Pos) : Option String.Pos := do\n guard <| (s.get i).isWhitespace\n s.nextWhile Char.isWhitespace (s.next i)",
"start": [
787,
1
],
"end": [
795,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeStrLitAux",
"code": "partial def decodeStrLitAux (s : String) (i : String.Pos) (acc : String) : Option String := do\n let c := s.get i\n let i := s.next i\n if c == '\\\"' then\n pure acc\n else if s.atEnd i then\n none\n else if c == '\\\\' then do\n if let some (c, i) := decodeQuotedChar s i then\n decodeStrLitAux s i (acc.push c)\n else if let some i := decodeStringGap s i then\n decodeStrLitAux s i acc\n else\n none\n else\n decodeStrLitAux s i (acc.push c)",
"start": [
797,
1
],
"end": [
812,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeRawStrLitAux",
"code": "partial def decodeRawStrLitAux (s : String) (i : String.Pos) (num : Nat) : String :=\n let c := s.get i\n let i := s.next i\n if c == '#' then\n decodeRawStrLitAux s i (num + 1)\n else\n s.extract i ⟨s.utf8ByteSize - (num + 1)⟩",
"start": [
814,
1
],
"end": [
826,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeStrLit",
"code": "def decodeStrLit (s : String) : Option String :=\n if s.get 0 == 'r' then\n decodeRawStrLitAux s ⟨1⟩ 0\n else\n decodeStrLitAux s ⟨1⟩ \"\"",
"start": [
828,
1
],
"end": [
840,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isStrLit?",
"code": "def isStrLit? (stx : Syntax) : Option String :=\n match isLit? strLitKind stx with\n | some val => decodeStrLit val\n | _ => none",
"start": [
842,
1
],
"end": [
851,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeCharLit",
"code": "def decodeCharLit (s : String) : Option Char := do\n let c := s.get ⟨1⟩\n if c == '\\\\' then do\n let (c, _) ← decodeQuotedChar s ⟨2⟩\n pure c\n else\n pure c",
"start": [
853,
1
],
"end": [
859,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isCharLit?",
"code": "def isCharLit? (stx : Syntax) : Option Char :=\n match isLit? charLitKind stx with\n | some val => decodeCharLit val\n | _ => none",
"start": [
861,
1
],
"end": [
864,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.splitNameLitAux",
"code": "private partial def splitNameLitAux (ss : Substring) (acc : List Substring) : List Substring :=\n let splitRest (ss : Substring) (acc : List Substring) : List Substring :=\n if ss.front == '.' then\n splitNameLitAux (ss.drop 1) acc\n else if ss.isEmpty then\n acc\n else\n []\n if ss.isEmpty then []\n else\n let curr := ss.front\n if isIdBeginEscape curr then\n let escapedPart := ss.takeWhile (!isIdEndEscape ·)\n let escapedPart := { escapedPart with stopPos := ss.stopPos.min (escapedPart.str.next escapedPart.stopPos) }\n if !isIdEndEscape (escapedPart.get <| escapedPart.prev ⟨escapedPart.bsize⟩) then []\n else splitRest (ss.extract ⟨escapedPart.bsize⟩ ⟨ss.bsize⟩) (escapedPart :: acc)\n else if isIdFirst curr then\n let idPart := ss.takeWhile isIdRest\n splitRest (ss.extract ⟨idPart.bsize⟩ ⟨ss.bsize⟩) (idPart :: acc)\n else if curr.isDigit then\n let idPart := ss.takeWhile Char.isDigit\n splitRest (ss.extract ⟨idPart.bsize⟩ ⟨ss.bsize⟩) (idPart :: acc)\n else\n []",
"start": [
866,
1
],
"end": [
889,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.splitNameLit",
"code": "def splitNameLit (ss : Substring) : List Substring :=\n splitNameLitAux ss [] |>.reverse",
"start": [
891,
1
],
"end": [
894,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Substring.toName",
"code": "def _root_.Substring.toName (s : Substring) : Name :=\n match splitNameLitAux s [] with\n | [] => .anonymous\n | comps => comps.foldr (init := Name.anonymous)\n fun comp n =>\n let comp := comp.toString\n if isIdBeginEscape comp.front then\n Name.mkStr n (comp.drop 1 |>.dropRight 1)\n else if comp.front.isDigit then\n if let some k := decodeNatLitVal? comp then\n Name.mkNum n k\n else\n unreachable!\n else\n Name.mkStr n comp",
"start": [
896,
1
],
"end": [
910,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toName",
"code": "def _root_.String.toName (s : String) : Name :=\n s.toSubstring.toName",
"start": [
912,
1
],
"end": [
918,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeNameLit",
"code": "def decodeNameLit (s : String) : Option Name :=\n if s.get 0 == '`' then\n match (s.toSubstring.drop 1).toName with\n | .anonymous => none\n | name => some name\n else\n none",
"start": [
920,
1
],
"end": [
926,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isNameLit?",
"code": "def isNameLit? (stx : Syntax) : Option Name :=\n match isLit? nameLitKind stx with\n | some val => decodeNameLit val\n | _ => none",
"start": [
928,
1
],
"end": [
931,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.hasArgs",
"code": "def hasArgs : Syntax → Bool\n | Syntax.node _ _ args => args.size > 0\n | _ => false",
"start": [
933,
1
],
"end": [
935,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isAtom",
"code": "def isAtom : Syntax → Bool\n | atom _ _ => true\n | _ => false",
"start": [
937,
1
],
"end": [
939,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isToken",
"code": "def isToken (token : String) : Syntax → Bool\n | atom _ val => val.trim == token.trim\n | _ => false",
"start": [
941,
1
],
"end": [
943,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isNone",
"code": "def isNone (stx : Syntax) : Bool :=\n match stx with\n | Syntax.node _ k args => k == nullKind && args.size == 0\n | Syntax.missing => true\n | _ => false",
"start": [
945,
1
],
"end": [
950,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getOptionalIdent?",
"code": "def getOptionalIdent? (stx : Syntax) : Option Name :=\n match stx.getOptional? with\n | some stx => some stx.getId\n | none => none",
"start": [
952,
1
],
"end": [
955,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.findAux",
"code": "partial def findAux (p : Syntax → Bool) : Syntax → Option Syntax\n | stx@(Syntax.node _ _ args) => if p stx then some stx else args.findSome? (findAux p)\n | stx => if p stx then some stx else none",
"start": [
957,
1
],
"end": [
959,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.find?",
"code": "def find? (stx : Syntax) (p : Syntax → Bool) : Option Syntax :=\n findAux p stx",
"start": [
961,
1
],
"end": [
962,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getNat",
"code": "def getNat (s : NumLit) : Nat :=\n s.raw.isNatLit?.getD 0",
"start": [
968,
1
],
"end": [
969,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getId",
"code": "def getId (s : Ident) : Name :=\n s.raw.getId",
"start": [
971,
1
],
"end": [
972,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getScientific",
"code": "def getScientific (s : ScientificLit) : Nat × Bool × Nat :=\n s.raw.isScientificLit?.getD (0, false, 0)",
"start": [
974,
1
],
"end": [
975,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getString",
"code": "def getString (s : StrLit) : String :=\n s.raw.isStrLit?.getD \"\"",
"start": [
977,
1
],
"end": [
978,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getChar",
"code": "def getChar (s : CharLit) : Char :=\n s.raw.isCharLit?.getD default",
"start": [
980,
1
],
"end": [
981,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getName",
"code": "def getName (s : NameLit) : Name :=\n s.raw.isNameLit?.getD .anonymous",
"start": [
983,
1
],
"end": [
984,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.TSyntax.getHygieneInfo",
"code": "def getHygieneInfo (s : HygieneInfo) : Name :=\n s.raw[0].getId",
"start": [
986,
1
],
"end": [
987,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HygieneInfo.mkIdent",
"code": "def HygieneInfo.mkIdent (s : HygieneInfo) (val : Name) (canonical := false) : Ident :=\n let src := s.raw[0]\n let id := { extractMacroScopes src.getId with name := val.eraseMacroScopes }.review\n ⟨Syntax.ident (SourceInfo.fromRef src canonical) (toString val).toSubstring id []⟩",
"start": [
998,
1
],
"end": [
1001,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Quote",
"code": "class Quote (α : Type) (k : SyntaxNodeKind := `term) where\n quote : α → TSyntax k",
"start": [
1003,
1
],
"end": [
1005,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.getEscapedNameParts?",
"code": "private def getEscapedNameParts? (acc : List String) : Name → Option (List String)\n | Name.anonymous => if acc.isEmpty then none else some acc\n | Name.str n s => do\n let s ← Name.escapePart s\n getEscapedNameParts? (s::acc) n\n | Name.num _ _ => none",
"start": [
1020,
1
],
"end": [
1025,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.quoteNameMk",
"code": "def quoteNameMk : Name → Term\n | .anonymous => mkCIdent ``Name.anonymous\n | .str n s => Syntax.mkCApp ``Name.mkStr #[quoteNameMk n, quote s]\n | .num n i => Syntax.mkCApp ``Name.mkNum #[quoteNameMk n, quote i]",
"start": [
1027,
1
],
"end": [
1030,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.quoteList",
"code": "private def quoteList [Quote α `term] : List α → Term\n | [] => mkCIdent ``List.nil\n | (x::xs) => Syntax.mkCApp ``List.cons #[quote x, quoteList xs]",
"start": [
1041,
1
],
"end": [
1043,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.quoteArray",
"code": "private def quoteArray [Quote α `term] (xs : Array α) : Term :=\n if xs.size <= 8 then\n go 0 #[]\n else\n Syntax.mkCApp ``List.toArray #[quote xs.toList]\nwhere\n go (i : Nat) (args : Array Term) : Term :=\n if h : i < xs.size then\n go (i+1) (args.push (quote xs[i]))\n else\n Syntax.mkCApp (Name.mkStr2 \"Array\" (\"mkArray\" ++ toString xs.size)) args\n termination_by xs.size - i\n decreasing_by decreasing_trivial_pre_omega",
"start": [
1048,
1
],
"end": [
1060,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Option.hasQuote",
"code": "instance Option.hasQuote {α : Type} [Quote α `term] : Quote (Option α) `term where\n quote\n | none => mkIdent ``none\n | (some x) => Syntax.mkCApp ``some #[quote x]",
"start": [
1065,
1
],
"end": [
1068,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.evalPrec",
"code": "def evalPrec (stx : Syntax) : MacroM Nat :=\n Macro.withIncRecDepth stx do\n let stx ← expandMacros stx\n match stx with\n | `(prec| $num:num) => return num.getNat\n | _ => Macro.throwErrorAt stx \"unexpected precedence\"",
"start": [
1071,
1
],
"end": [
1077,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.evalPrio",
"code": "def evalPrio (stx : Syntax) : MacroM Nat :=\n Macro.withIncRecDepth stx do\n let stx ← expandMacros stx\n match stx with\n | `(prio| $num:num) => return num.getNat\n | _ => Macro.throwErrorAt stx \"unexpected priority\"",
"start": [
1087,
1
],
"end": [
1093,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.evalOptPrio",
"code": "def evalOptPrio : Option (TSyntax `prio) → MacroM Nat\n | some prio => evalPrio prio\n | none => return 1000",
"start": [
1103,
1
],
"end": [
1105,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.getSepElems",
"code": "abbrev getSepElems := @getEvenElems",
"start": [
1111,
1
],
"end": [
1111,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterSepElemsMAux",
"code": "private partial def filterSepElemsMAux {m : Type → Type} [Monad m] (a : Array Syntax) (p : Syntax → m Bool) (i : Nat) (acc : Array Syntax) : m (Array Syntax) := do\n if h : i < a.size then\n let stx := a[i]\n if (← p stx) then\n if acc.isEmpty then\n filterSepElemsMAux a p (i+2) (acc.push stx)\n else if hz : i ≠ 0 then\n have : i.pred < i := Nat.pred_lt hz\n have : i.pred < a.size := Nat.lt_trans this h\n let sepStx := a[i.pred]\n filterSepElemsMAux a p (i+2) ((acc.push sepStx).push stx)\n else\n filterSepElemsMAux a p (i+2) (acc.push stx)\n else\n filterSepElemsMAux a p (i+2) acc\n else\n pure acc",
"start": [
1115,
1
],
"end": [
1131,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterSepElemsM",
"code": "def filterSepElemsM {m : Type → Type} [Monad m] (a : Array Syntax) (p : Syntax → m Bool) : m (Array Syntax) :=\n filterSepElemsMAux a p 0 #[]",
"start": [
1133,
1
],
"end": [
1134,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.filterSepElems",
"code": "def filterSepElems (a : Array Syntax) (p : Syntax → Bool) : Array Syntax :=\n Id.run <| a.filterSepElemsM p",
"start": [
1136,
1
],
"end": [
1137,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapSepElemsMAux",
"code": "private partial def mapSepElemsMAux {m : Type → Type} [Monad m] (a : Array Syntax) (f : Syntax → m Syntax) (i : Nat) (acc : Array Syntax) : m (Array Syntax) := do\n if h : i < a.size then\n let stx := a[i]\n if i % 2 == 0 then do\n let stx ← f stx\n mapSepElemsMAux a f (i+1) (acc.push stx)\n else\n mapSepElemsMAux a f (i+1) (acc.push stx)\n else\n pure acc",
"start": [
1139,
1
],
"end": [
1148,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapSepElemsM",
"code": "def mapSepElemsM {m : Type → Type} [Monad m] (a : Array Syntax) (f : Syntax → m Syntax) : m (Array Syntax) :=\n mapSepElemsMAux a f 0 #[]",
"start": [
1150,
1
],
"end": [
1151,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapSepElems",
"code": "def mapSepElems (a : Array Syntax) (f : Syntax → Syntax) : Array Syntax :=\n Id.run <| a.mapSepElemsM f",
"start": [
1153,
1
],
"end": [
1154,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.SepArray.getElems",
"code": "def SepArray.getElems (sa : SepArray sep) : Array Syntax :=\n sa.elemsAndSeps.getSepElems",
"start": [
1160,
1
],
"end": [
1161,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.TSepArray.getElems",
"code": "def TSepArray.getElems (sa : TSepArray k sep) : TSyntaxArray k :=\n .mk sa.elemsAndSeps.getSepElems",
"start": [
1163,
1
],
"end": [
1164,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.TSepArray.push",
"code": "def TSepArray.push (sa : TSepArray k sep) (e : TSyntax k) : TSepArray k sep :=\n if sa.elemsAndSeps.isEmpty then\n { elemsAndSeps := #[e] }\n else\n { elemsAndSeps := sa.elemsAndSeps.push (mkAtom sep) |>.push e }",
"start": [
1166,
1
],
"end": [
1170,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeInterpStrQuotedChar",
"code": "private def decodeInterpStrQuotedChar (s : String) (i : String.Pos) : Option (Char × String.Pos) := do\n match decodeQuotedChar s i with\n | some r => some r\n | none =>\n let c := s.get i\n let i := s.next i\n if c == '{' then pure ('{', i)\n else none",
"start": [
1202,
1
],
"end": [
1209,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.decodeInterpStrLit",
"code": "private partial def decodeInterpStrLit (s : String) : Option String :=\n let rec loop (i : String.Pos) (acc : String) : Option String :=\n let c := s.get i\n let i := s.next i\n if c == '\\\"' || c == '{' then\n pure acc\n else if s.atEnd i then\n none\n else if c == '\\\\' then do\n if let some (c, i) := decodeInterpStrQuotedChar s i then\n loop i (acc.push c)\n else if let some i := decodeStringGap s i then\n loop i acc\n else\n none\n else\n loop i (acc.push c)\n loop ⟨1⟩ \"\"",
"start": [
1211,
1
],
"end": [
1228,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.isInterpolatedStrLit?",
"code": "partial def isInterpolatedStrLit? (stx : Syntax) : Option String :=\n match isLit? interpolatedStrLitKind stx with\n | none => none\n | some val => decodeInterpStrLit val",
"start": [
1230,
1
],
"end": [
1233,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Syntax.getSepArgs",
"code": "def getSepArgs (stx : Syntax) : Array Syntax :=\n stx.getArgs.getSepElems",
"start": [
1235,
1
],
"end": [
1236,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "TSyntax.expandInterpolatedStrChunks",
"code": "def expandInterpolatedStrChunks (chunks : Array Syntax) (mkAppend : Syntax → Syntax → MacroM Syntax) (mkElem : Syntax → MacroM Syntax) : MacroM Syntax := do\n let mut i := 0\n let mut result := Syntax.missing\n for elem in chunks do\n let elem ← match elem.isInterpolatedStrLit? with\n | none => mkElem elem\n | some str => mkElem (Syntax.mkStrLit str)\n if i == 0 then\n result := elem\n else\n result ← mkAppend result elem\n i := i+1\n return result",
"start": [
1242,
1
],
"end": [
1254,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "TSyntax.expandInterpolatedStr",
"code": "def expandInterpolatedStr (interpStr : TSyntax interpolatedStrKind) (type : Term) (toTypeFn : Term) : MacroM Term := do\n let r ← expandInterpolatedStrChunks interpStr.raw.getArgs (fun a b => `($a ++ $b)) (fun a => `($toTypeFn $a))\n `(($r : $type))",
"start": [
1257,
1
],
"end": [
1259,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "TSyntax.getDocString",
"code": "def getDocString (stx : TSyntax `Lean.Parser.Command.docComment) : String :=\n match stx.raw[1] with\n | Syntax.atom _ val => val.extract 0 (val.endPos - ⟨2⟩)\n | _ => \"\"",
"start": [
1261,
1
],
"end": [
1264,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.Occurrences.contains",
"code": "def Occurrences.contains : Occurrences → Nat → Bool\n | all, _ => true\n | pos idxs, idx => idxs.contains idx\n | neg idxs, idx => !idxs.contains idx",
"start": [
1272,
1
],
"end": [
1275,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.Occurrences.isAll",
"code": "def Occurrences.isAll : Occurrences → Bool\n | all => true\n | _ => false",
"start": [
1277,
1
],
"end": [
1279,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.ApplyNewGoals",
"code": "inductive ApplyNewGoals where\n | nonDependentFirst | nonDependentOnly | all",
"start": [
1281,
1
],
"end": [
1289,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.ApplyConfig",
"code": "structure ApplyConfig where\n newGoals := ApplyNewGoals.nonDependentFirst\n \n synthAssignedInstances := true\n \n allowSynthFailures := false\n \n approx : Bool := true",
"start": [
1291,
1
],
"end": [
1310,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.Rewrite.NewGoals",
"code": "abbrev NewGoals := ApplyNewGoals",
"start": [
1314,
1
],
"end": [
1314,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.Rewrite.Config",
"code": "structure Config where\n transparency : TransparencyMode := .reducible\n offsetCnstrs : Bool := true\n occs : Occurrences := .all\n newGoals : NewGoals := .nonDependentFirst",
"start": [
1316,
1
],
"end": [
1320,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.Omega.OmegaConfig",
"code": "structure OmegaConfig where\n \n splitDisjunctions : Bool := true\n \n splitNatSub : Bool := true\n \n splitNatAbs : Bool := true\n \n splitMinMax : Bool := true",
"start": [
1326,
1
],
"end": [
1355,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Meta.CheckTactic.CheckGoalType",
"code": "inductive CheckGoalType {α : Sort u} : (val : α) → Prop where\n| intro : (val : α) → CheckGoalType val",
"start": [
1361,
1
],
"end": [
1368,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Parser.Tactic.expandSimp",
"code": "@[macro $tacName] def expandSimp : Macro := fun s => do\n let c ← match s[1][0] with\n | `(config| (config := $$c)) => `(config| (config := $updateCfg $$c))\n | _ => `(config| (config := $updateCfg {}))\n let s := s.setKind $kind\n let s := s.setArg 0 (mkAtomFrom s[0] $tkn (canonical := true))\n let r := s.setArg 1 (mkNullNode #[c])\n return r",
"start": [
1398,
5
],
"end": [
1405,
15
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/NotationExtra.lean | [
".lake/packages/lean4/src/lean/Init/Meta.lean",
".lake/packages/lean4/src/lean/Init/Data/Array/Subarray.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/Conv.lean"
] | [
{
"full_name": "Lean.expandExplicitBindersAux",
"code": "def expandExplicitBindersAux (combinator : Syntax) (idents : Array Syntax) (type? : Option Syntax) (body : Syntax) : MacroM Syntax :=\n let rec loop (i : Nat) (acc : Syntax) := do\n match i with\n | 0 => pure acc\n | i+1 =>\n let ident := idents[i]![0]\n let acc ← match ident.isIdent, type? with\n | true, none => `($combinator fun $ident => $acc)\n | true, some type => `($combinator fun $ident : $type => $acc)\n | false, none => `($combinator fun _ => $acc)\n | false, some type => `($combinator fun _ : $type => $acc)\n loop i acc\n loop idents.size body",
"start": [
23,
1
],
"end": [
35,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.expandBrackedBindersAux",
"code": "def expandBrackedBindersAux (combinator : Syntax) (binders : Array Syntax) (body : Syntax) : MacroM Syntax :=\n let rec loop (i : Nat) (acc : Syntax) := do\n match i with\n | 0 => pure acc\n | i+1 =>\n let idents := binders[i]![1].getArgs\n let type := binders[i]![3]\n loop i (← expandExplicitBindersAux combinator idents (some type) acc)\n loop binders.size body",
"start": [
37,
1
],
"end": [
45,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.expandExplicitBinders",
"code": "def expandExplicitBinders (combinatorDeclName : Name) (explicitBinders : Syntax) (body : Syntax) : MacroM Syntax := do\n let combinator := mkCIdentFrom (← getRef) combinatorDeclName\n let explicitBinders := explicitBinders[0]\n if explicitBinders.getKind == ``Lean.unbracketedExplicitBinders then\n let idents := explicitBinders[0].getArgs\n let type? := if explicitBinders[1].isNone then none else some explicitBinders[1][1]\n expandExplicitBindersAux combinator idents type? body\n else if explicitBinders.getArgs.all (·.getKind == ``Lean.bracketedExplicitBinders) then\n expandBrackedBindersAux combinator explicitBinders.getArgs body\n else\n Macro.throwError \"unexpected explicit binder\"",
"start": [
47,
1
],
"end": [
57,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.expandBrackedBinders",
"code": "def expandBrackedBinders (combinatorDeclName : Name) (bracketedExplicitBinders : Syntax) (body : Syntax) : MacroM Syntax := do\n let combinator := mkCIdentFrom (← getRef) combinatorDeclName\n expandBrackedBindersAux combinator #[bracketedExplicitBinders] body",
"start": [
59,
1
],
"end": [
61,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandUnit",
"code": "@[app_unexpander Unit.unit] def unexpandUnit : Lean.PrettyPrinter.Unexpander\n | `($(_)) => `(())",
"start": [
142,
1
],
"end": [
143,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandListNil",
"code": "@[app_unexpander List.nil] def unexpandListNil : Lean.PrettyPrinter.Unexpander\n | `($(_)) => `([])",
"start": [
145,
1
],
"end": [
146,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandListCons",
"code": "@[app_unexpander List.cons] def unexpandListCons : Lean.PrettyPrinter.Unexpander\n | `($(_) $x $tail) =>\n match tail with\n | `([]) => `([$x])\n | `([$xs,*]) => `([$x, $xs,*])\n | `(⋯) => `([$x, $tail]) | _ => throw ()\n | _ => throw ()",
"start": [
148,
1
],
"end": [
155,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandListToArray",
"code": "@[app_unexpander List.toArray] def unexpandListToArray : Lean.PrettyPrinter.Unexpander\n | `($(_) [$xs,*]) => `(#[$xs,*])\n | _ => throw ()",
"start": [
157,
1
],
"end": [
159,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandProdMk",
"code": "@[app_unexpander Prod.mk] def unexpandProdMk : Lean.PrettyPrinter.Unexpander\n | `($(_) $x ($y, $ys,*)) => `(($x, $y, $ys,*))\n | `($(_) $x $y) => `(($x, $y))\n | _ => throw ()",
"start": [
161,
1
],
"end": [
164,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandIte",
"code": "@[app_unexpander ite] def unexpandIte : Lean.PrettyPrinter.Unexpander\n | `($(_) $c $t $e) => `(if $c then $t else $e)\n | _ => throw ()",
"start": [
166,
1
],
"end": [
168,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandSorryAx",
"code": "@[app_unexpander sorryAx] def unexpandSorryAx : Lean.PrettyPrinter.Unexpander\n | `($(_) _) => `(sorry)\n | `($(_) _ _) => `(sorry)\n | _ => throw ()",
"start": [
170,
1
],
"end": [
173,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandEqNDRec",
"code": "@[app_unexpander Eq.ndrec] def unexpandEqNDRec : Lean.PrettyPrinter.Unexpander\n | `($(_) $m $h) => `($h ▸ $m)\n | _ => throw ()",
"start": [
175,
1
],
"end": [
177,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandEqRec",
"code": "@[app_unexpander Eq.rec] def unexpandEqRec : Lean.PrettyPrinter.Unexpander\n | `($(_) $m $h) => `($h ▸ $m)\n | _ => throw ()",
"start": [
179,
1
],
"end": [
181,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandExists",
"code": "@[app_unexpander Exists] def unexpandExists : Lean.PrettyPrinter.Unexpander\n | `($(_) fun $x:ident => ∃ $xs:binderIdent*, $b) => `(∃ $x:ident $xs:binderIdent*, $b)\n | `($(_) fun $x:ident => $b) => `(∃ $x:ident, $b)\n | `($(_) fun ($x:ident : $t) => $b) => `(∃ ($x:ident : $t), $b)\n | _ => throw ()",
"start": [
183,
1
],
"end": [
187,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandSigma",
"code": "@[app_unexpander Sigma] def unexpandSigma : Lean.PrettyPrinter.Unexpander\n | `($(_) fun ($x:ident : $t) => $b) => `(($x:ident : $t) × $b)\n | _ => throw ()",
"start": [
189,
1
],
"end": [
191,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandPSigma",
"code": "@[app_unexpander PSigma] def unexpandPSigma : Lean.PrettyPrinter.Unexpander\n | `($(_) fun ($x:ident : $t) => $b) => `(($x:ident : $t) ×' $b)\n | _ => throw ()",
"start": [
193,
1
],
"end": [
195,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandSubtype",
"code": "@[app_unexpander Subtype] def unexpandSubtype : Lean.PrettyPrinter.Unexpander\n | `($(_) fun ($x:ident : $type) => $p) => `({ $x : $type // $p })\n | `($(_) fun $x:ident => $p) => `({ $x // $p })\n | _ => throw ()",
"start": [
197,
1
],
"end": [
200,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandTSyntax",
"code": "@[app_unexpander TSyntax] def unexpandTSyntax : Lean.PrettyPrinter.Unexpander\n | `($f [$k]) => `($f $k)\n | _ => throw ()",
"start": [
202,
1
],
"end": [
204,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandTSyntaxArray",
"code": "@[app_unexpander TSyntaxArray] def unexpandTSyntaxArray : Lean.PrettyPrinter.Unexpander\n | `($f [$k]) => `($f $k)\n | _ => throw ()",
"start": [
206,
1
],
"end": [
208,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandTSepArray",
"code": "@[app_unexpander Syntax.TSepArray] def unexpandTSepArray : Lean.PrettyPrinter.Unexpander\n | `($f [$k] $sep) => `($f $k $sep)\n | _ => throw ()",
"start": [
210,
1
],
"end": [
212,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandGetElem",
"code": "@[app_unexpander GetElem.getElem] def unexpandGetElem : Lean.PrettyPrinter.Unexpander\n | `($_ $array $index $_) => `($array[$index])\n | _ => throw ()",
"start": [
214,
1
],
"end": [
216,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandGetElem!",
"code": "@[app_unexpander getElem!] def unexpandGetElem! : Lean.PrettyPrinter.Unexpander\n | `($_ $array $index) => `($array[$index]!)\n | _ => throw ()",
"start": [
218,
1
],
"end": [
220,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandGetElem?",
"code": "@[app_unexpander getElem?] def unexpandGetElem? : Lean.PrettyPrinter.Unexpander\n | `($_ $array $index) => `($array[$index]?)\n | _ => throw ()",
"start": [
222,
1
],
"end": [
224,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr1",
"code": "@[app_unexpander Name.mkStr1] def unexpandMkStr1 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a.getString)]\n | _ => throw ()",
"start": [
226,
1
],
"end": [
228,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr2",
"code": "@[app_unexpander Name.mkStr2] def unexpandMkStr2 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString)]\n | _ => throw ()",
"start": [
230,
1
],
"end": [
232,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr3",
"code": "@[app_unexpander Name.mkStr3] def unexpandMkStr3 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString)]\n | _ => throw ()",
"start": [
234,
1
],
"end": [
236,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr4",
"code": "@[app_unexpander Name.mkStr4] def unexpandMkStr4 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str $a4:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString ++ \".\" ++ a4.getString)]\n | _ => throw ()",
"start": [
238,
1
],
"end": [
240,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr5",
"code": "@[app_unexpander Name.mkStr5] def unexpandMkStr5 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str $a4:str $a5:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString ++ \".\" ++ a4.getString ++ \".\" ++ a5.getString)]\n | _ => throw ()",
"start": [
242,
1
],
"end": [
244,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr6",
"code": "@[app_unexpander Name.mkStr6] def unexpandMkStr6 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str $a4:str $a5:str $a6:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString ++ \".\" ++ a4.getString ++ \".\" ++ a5.getString ++ \".\" ++ a6.getString)]\n | _ => throw ()",
"start": [
246,
1
],
"end": [
248,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr7",
"code": "@[app_unexpander Name.mkStr7] def unexpandMkStr7 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str $a4:str $a5:str $a6:str $a7:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString ++ \".\" ++ a4.getString ++ \".\" ++ a5.getString ++ \".\" ++ a6.getString ++ \".\" ++ a7.getString)]\n | _ => throw ()",
"start": [
250,
1
],
"end": [
252,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkStr8",
"code": "@[app_unexpander Name.mkStr8] def unexpandMkStr8 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1:str $a2:str $a3:str $a4:str $a5:str $a6:str $a7:str $a8:str) => return mkNode `Lean.Parser.Term.quotedName #[Syntax.mkNameLit (\"`\" ++ a1.getString ++ \".\" ++ a2.getString ++ \".\" ++ a3.getString ++ \".\" ++ a4.getString ++ \".\" ++ a5.getString ++ \".\" ++ a6.getString ++ \".\" ++ a7.getString ++ \".\" ++ a8.getString)]\n | _ => throw ()",
"start": [
254,
1
],
"end": [
256,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandArrayEmpty",
"code": "@[app_unexpander Array.empty] def unexpandArrayEmpty : Lean.PrettyPrinter.Unexpander\n | _ => `(#[])",
"start": [
258,
1
],
"end": [
259,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray0",
"code": "@[app_unexpander Array.mkArray0] def unexpandMkArray0 : Lean.PrettyPrinter.Unexpander\n | _ => `(#[])",
"start": [
261,
1
],
"end": [
262,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray1",
"code": "@[app_unexpander Array.mkArray1] def unexpandMkArray1 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1) => `(#[$a1])\n | _ => throw ()",
"start": [
264,
1
],
"end": [
266,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray2",
"code": "@[app_unexpander Array.mkArray2] def unexpandMkArray2 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2) => `(#[$a1, $a2])\n | _ => throw ()",
"start": [
268,
1
],
"end": [
270,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray3",
"code": "@[app_unexpander Array.mkArray3] def unexpandMkArray3 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3) => `(#[$a1, $a2, $a3])\n | _ => throw ()",
"start": [
272,
1
],
"end": [
274,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray4",
"code": "@[app_unexpander Array.mkArray4] def unexpandMkArray4 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3 $a4) => `(#[$a1, $a2, $a3, $a4])\n | _ => throw ()",
"start": [
276,
1
],
"end": [
278,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray5",
"code": "@[app_unexpander Array.mkArray5] def unexpandMkArray5 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3 $a4 $a5) => `(#[$a1, $a2, $a3, $a4, $a5])\n | _ => throw ()",
"start": [
280,
1
],
"end": [
282,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray6",
"code": "@[app_unexpander Array.mkArray6] def unexpandMkArray6 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3 $a4 $a5 $a6) => `(#[$a1, $a2, $a3, $a4, $a5, $a6])\n | _ => throw ()",
"start": [
284,
1
],
"end": [
286,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray7",
"code": "@[app_unexpander Array.mkArray7] def unexpandMkArray7 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3 $a4 $a5 $a6 $a7) => `(#[$a1, $a2, $a3, $a4, $a5, $a6, $a7])\n | _ => throw ()",
"start": [
288,
1
],
"end": [
290,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "unexpandMkArray8",
"code": "@[app_unexpander Array.mkArray8] def unexpandMkArray8 : Lean.PrettyPrinter.Unexpander\n | `($(_) $a1 $a2 $a3 $a4 $a5 $a6 $a7 $a8) => `(#[$a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8])\n | _ => throw ()",
"start": [
292,
1
],
"end": [
294,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Loop",
"code": "inductive Loop where\n | mk",
"start": [
381,
1
],
"end": [
382,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Loop.forIn",
"code": "@[inline]\npartial def Loop.forIn {β : Type u} {m : Type u → Type v} [Monad m] (_ : Loop) (init : β) (f : Unit → β → m (ForInStep β)) : m β :=\n let rec @[specialize] loop (b : β) : m β := do\n match ← f () b with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop b\n loop init",
"start": [
384,
1
],
"end": [
390,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.singletonUnexpander",
"code": "@[app_unexpander singleton]\ndef singletonUnexpander : Lean.PrettyPrinter.Unexpander\n | `($_ $a) => `({ $a:term })\n | _ => throw ()",
"start": [
428,
1
],
"end": [
432,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.insertUnexpander",
"code": "@[app_unexpander insert]\ndef insertUnexpander : Lean.PrettyPrinter.Unexpander\n | `($_ $a { $ts:term,* }) => `({$a:term, $ts,*})\n | _ => throw ()",
"start": [
434,
1
],
"end": [
438,
18
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/PropLemmas.lean | [
".lake/packages/lean4/src/lean/Init/NotationExtra.lean",
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "eq_mp_eq_cast",
"code": "@[simp] theorem eq_mp_eq_cast (h : α = β) : Eq.mp h = cast h",
"start": [
16,
1
],
"end": [
16,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_mpr_eq_cast",
"code": "@[simp] theorem eq_mpr_eq_cast (h : α = β) : Eq.mpr h = cast h.symm",
"start": [
17,
1
],
"end": [
17,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "cast_cast",
"code": "@[simp] theorem cast_cast : ∀ (ha : α = β) (hb : β = γ) (a : α),\n cast hb (cast ha a) = cast (ha.trans hb) a",
"start": [
19,
1
],
"end": [
21,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_true_eq_id",
"code": "@[simp] theorem eq_true_eq_id : Eq True = id",
"start": [
23,
1
],
"end": [
24,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "proof_irrel_heq",
"code": "theorem proof_irrel_heq {p q : Prop} (hp : p) (hq : q) : HEq hp hq",
"start": [
26,
1
],
"end": [
27,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "not_not_em",
"code": "theorem not_not_em (a : Prop) : ¬¬(a ∨ ¬a)",
"start": [
31,
1
],
"end": [
31,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "and_self_iff",
"code": "theorem and_self_iff : a ∧ a ↔ a",
"start": [
35,
1
],
"end": [
35,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "and_not_self_iff",
"code": "theorem and_not_self_iff (a : Prop) : a ∧ ¬a ↔ False",
"start": [
36,
1
],
"end": [
36,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and_self_iff",
"code": "theorem not_and_self_iff (a : Prop) : ¬a ∧ a ↔ False",
"start": [
37,
1
],
"end": [
37,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "And.imp",
"code": "theorem And.imp (f : a → c) (g : b → d) (h : a ∧ b) : c ∧ d",
"start": [
39,
1
],
"end": [
39,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "And.imp_left",
"code": "theorem And.imp_left (h : a → b) : a ∧ c → b ∧ c",
"start": [
40,
1
],
"end": [
40,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "And.imp_right",
"code": "theorem And.imp_right (h : a → b) : c ∧ a → c ∧ b",
"start": [
41,
1
],
"end": [
41,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr",
"code": "theorem and_congr (h₁ : a ↔ c) (h₂ : b ↔ d) : a ∧ b ↔ c ∧ d",
"start": [
43,
1
],
"end": [
44,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_left'",
"code": "theorem and_congr_left' (h : a ↔ b) : a ∧ c ↔ b ∧ c",
"start": [
45,
1
],
"end": [
45,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_right'",
"code": "theorem and_congr_right' (h : b ↔ c) : a ∧ b ↔ a ∧ c",
"start": [
46,
1
],
"end": [
46,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and_of_not_left",
"code": "theorem not_and_of_not_left (b : Prop) : ¬a → ¬(a ∧ b)",
"start": [
48,
1
],
"end": [
48,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and_of_not_right",
"code": "theorem not_and_of_not_right (a : Prop) {b : Prop} : ¬b → ¬(a ∧ b)",
"start": [
49,
1
],
"end": [
49,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_right_eq",
"code": "theorem and_congr_right_eq (h : a → b = c) : (a ∧ b) = (a ∧ c)",
"start": [
51,
1
],
"end": [
52,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "and_congr_left_eq",
"code": "theorem and_congr_left_eq (h : c → a = b) : (a ∧ c) = (b ∧ c)",
"start": [
53,
1
],
"end": [
54,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "and_left_comm",
"code": "theorem and_left_comm : a ∧ b ∧ c ↔ b ∧ a ∧ c",
"start": [
56,
1
],
"end": [
58,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "and_right_comm",
"code": "theorem and_right_comm : (a ∧ b) ∧ c ↔ (a ∧ c) ∧ b",
"start": [
60,
1
],
"end": [
62,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "and_rotate",
"code": "theorem and_rotate : a ∧ b ∧ c ↔ b ∧ c ∧ a",
"start": [
64,
1
],
"end": [
64,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "and_and_and_comm",
"code": "theorem and_and_and_comm : (a ∧ b) ∧ c ∧ d ↔ (a ∧ c) ∧ b ∧ d",
"start": [
65,
1
],
"end": [
65,
114
],
"kind": "commanddeclaration"
},
{
"full_name": "and_and_left",
"code": "theorem and_and_left : a ∧ (b ∧ c) ↔ (a ∧ b) ∧ a ∧ c",
"start": [
66,
1
],
"end": [
66,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "and_and_right",
"code": "theorem and_and_right : (a ∧ b) ∧ c ↔ (a ∧ c) ∧ b ∧ c",
"start": [
67,
1
],
"end": [
67,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_left",
"code": "theorem and_iff_left (hb : b) : a ∧ b ↔ a",
"start": [
69,
1
],
"end": [
69,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "and_iff_right",
"code": "theorem and_iff_right (ha : a) : a ∧ b ↔ b",
"start": [
70,
1
],
"end": [
70,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "or_self_iff",
"code": "theorem or_self_iff : a ∨ a ↔ a",
"start": [
74,
1
],
"end": [
74,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "not_or_intro",
"code": "theorem not_or_intro {a b : Prop} (ha : ¬a) (hb : ¬b) : ¬(a ∨ b)",
"start": [
75,
1
],
"end": [
75,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "or_congr",
"code": "theorem or_congr (h₁ : a ↔ c) (h₂ : b ↔ d) : (a ∨ b) ↔ (c ∨ d)",
"start": [
77,
1
],
"end": [
77,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "or_congr_left",
"code": "theorem or_congr_left (h : a ↔ b) : a ∨ c ↔ b ∨ c",
"start": [
78,
1
],
"end": [
78,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "or_congr_right",
"code": "theorem or_congr_right (h : b ↔ c) : a ∨ b ↔ a ∨ c",
"start": [
79,
1
],
"end": [
79,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "or_left_comm",
"code": "theorem or_left_comm : a ∨ (b ∨ c) ↔ b ∨ (a ∨ c)",
"start": [
81,
1
],
"end": [
81,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "or_right_comm",
"code": "theorem or_right_comm : (a ∨ b) ∨ c ↔ (a ∨ c) ∨ b",
"start": [
82,
1
],
"end": [
82,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "or_or_or_comm",
"code": "theorem or_or_or_comm : (a ∨ b) ∨ c ∨ d ↔ (a ∨ c) ∨ b ∨ d",
"start": [
84,
1
],
"end": [
84,
108
],
"kind": "commanddeclaration"
},
{
"full_name": "or_or_distrib_left",
"code": "theorem or_or_distrib_left : a ∨ b ∨ c ↔ (a ∨ b) ∨ a ∨ c",
"start": [
86,
1
],
"end": [
86,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "or_or_distrib_right",
"code": "theorem or_or_distrib_right : (a ∨ b) ∨ c ↔ (a ∨ c) ∨ b ∨ c",
"start": [
87,
1
],
"end": [
87,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "or_rotate",
"code": "theorem or_rotate : a ∨ b ∨ c ↔ b ∨ c ∨ a",
"start": [
89,
1
],
"end": [
89,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_left",
"code": "theorem or_iff_left (hb : ¬b) : a ∨ b ↔ a",
"start": [
91,
1
],
"end": [
91,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "or_iff_right",
"code": "theorem or_iff_right (ha : ¬a) : a ∨ b ↔ b",
"start": [
92,
1
],
"end": [
92,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "not_imp_of_and_not",
"code": "theorem not_imp_of_and_not : a ∧ ¬b → ¬(a → b)",
"start": [
96,
1
],
"end": [
97,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "imp_and",
"code": "theorem imp_and {α} : (α → b ∧ c) ↔ (α → b) ∧ (α → c)",
"start": [
99,
1
],
"end": [
100,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and'",
"code": "theorem not_and' : ¬(a ∧ b) ↔ b → ¬a",
"start": [
102,
1
],
"end": [
102,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "and_or_left",
"code": "theorem and_or_left : a ∧ (b ∨ c) ↔ (a ∧ b) ∨ (a ∧ c)",
"start": [
104,
1
],
"end": [
107,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "or_and_right",
"code": "theorem or_and_right : (a ∨ b) ∧ c ↔ (a ∧ c) ∨ (b ∧ c)",
"start": [
109,
1
],
"end": [
110,
123
],
"kind": "commanddeclaration"
},
{
"full_name": "or_and_left",
"code": "theorem or_and_left : a ∨ (b ∧ c) ↔ (a ∨ b) ∧ (a ∨ c)",
"start": [
112,
1
],
"end": [
115,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "and_or_right",
"code": "theorem and_or_right : (a ∧ b) ∨ c ↔ (a ∨ c) ∧ (b ∨ c)",
"start": [
117,
1
],
"end": [
118,
120
],
"kind": "commanddeclaration"
},
{
"full_name": "or_imp",
"code": "theorem or_imp : (a ∨ b → c) ↔ (a → c) ∧ (b → c)",
"start": [
120,
1
],
"end": [
121,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "not_or",
"code": "@[simp] theorem not_or : ¬(p ∨ q) ↔ ¬p ∧ ¬q",
"start": [
134,
1
],
"end": [
134,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "not_and_of_not_or_not",
"code": "theorem not_and_of_not_or_not (h : ¬a ∨ ¬b) : ¬(a ∧ b)",
"start": [
136,
1
],
"end": [
136,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "if_false_left",
"code": "@[simp]\ntheorem if_false_left [h : Decidable p] :\n ite p False q ↔ ¬p ∧ q",
"start": [
141,
1
],
"end": [
143,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "if_false_right",
"code": "@[simp]\ntheorem if_false_right [h : Decidable p] :\n ite p q False ↔ p ∧ q",
"start": [
145,
1
],
"end": [
147,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "if_true_left",
"code": "@[simp low]\ntheorem if_true_left [h : Decidable p] :\n ite p True q ↔ ¬p → q",
"start": [
155,
1
],
"end": [
157,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "if_true_right",
"code": "@[simp low]\ntheorem if_true_right [h : Decidable p] :\n ite p q True ↔ p → q",
"start": [
159,
1
],
"end": [
161,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_not",
"code": "@[simp] theorem dite_not [hn : Decidable (¬p)] [h : Decidable p] (x : ¬p → α) (y : ¬¬p → α) :\n dite (¬p) x y = dite p (fun h => y (not_not_intro h)) x",
"start": [
163,
1
],
"end": [
166,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_not",
"code": "@[simp] theorem ite_not (p : Prop) [Decidable p] (x y : α) : ite (¬p) x y = ite p y x",
"start": [
168,
1
],
"end": [
170,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_true_same",
"code": "@[simp] theorem ite_true_same (p q : Prop) [h : Decidable p] : (if p then p else q) = (¬p → q)",
"start": [
172,
1
],
"end": [
173,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_false_same",
"code": "@[simp] theorem ite_false_same (p q : Prop) [h : Decidable p] : (if p then q else p) = (p ∧ q)",
"start": [
175,
1
],
"end": [
176,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_imp",
"code": "theorem forall_imp (h : ∀ a, p a → q a) : (∀ a, p a) → ∀ a, q a",
"start": [
183,
1
],
"end": [
183,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_exists_index",
"code": "@[simp] theorem forall_exists_index {q : (∃ x, p x) → Prop} :\n (∀ h, q h) ↔ ∀ x (h : p x), q ⟨x, h⟩",
"start": [
185,
1
],
"end": [
191,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.imp",
"code": "theorem Exists.imp (h : ∀ a, p a → q a) : (∃ a, p a) → ∃ a, q a",
"start": [
193,
1
],
"end": [
194,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.imp'",
"code": "theorem Exists.imp' {β} {q : β → Prop} (f : α → β) (hpq : ∀ a, p a → q (f a)) :\n (∃ a, p a) → ∃ b, q b",
"start": [
196,
1
],
"end": [
198,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_imp",
"code": "theorem exists_imp : ((∃ x, p x) → b) ↔ ∀ x, p x → b",
"start": [
200,
1
],
"end": [
200,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_const",
"code": "@[simp] theorem exists_const (α) [i : Nonempty α] : (∃ _ : α, b) ↔ b",
"start": [
202,
1
],
"end": [
203,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_congr'",
"code": "theorem forall_congr' (h : ∀ a, p a ↔ q a) : (∀ a, p a) ↔ ∀ a, q a",
"start": [
207,
1
],
"end": [
208,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_congr",
"code": "theorem exists_congr (h : ∀ a, p a ↔ q a) : (∃ a, p a) ↔ ∃ a, q a",
"start": [
210,
1
],
"end": [
211,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "forall₂_congr",
"code": "theorem forall₂_congr {p q : ∀ a, β a → Prop} (h : ∀ a b, p a b ↔ q a b) :\n (∀ a b, p a b) ↔ ∀ a b, q a b",
"start": [
215,
1
],
"end": [
217,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "exists₂_congr",
"code": "theorem exists₂_congr {p q : ∀ a, β a → Prop} (h : ∀ a b, p a b ↔ q a b) :\n (∃ a b, p a b) ↔ ∃ a b, q a b",
"start": [
219,
1
],
"end": [
221,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "forall₃_congr",
"code": "theorem forall₃_congr {p q : ∀ a b, γ a b → Prop} (h : ∀ a b c, p a b c ↔ q a b c) :\n (∀ a b c, p a b c) ↔ ∀ a b c, q a b c",
"start": [
224,
1
],
"end": [
226,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "exists₃_congr",
"code": "theorem exists₃_congr {p q : ∀ a b, γ a b → Prop} (h : ∀ a b c, p a b c ↔ q a b c) :\n (∃ a b c, p a b c) ↔ ∃ a b c, q a b c",
"start": [
228,
1
],
"end": [
230,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "forall₄_congr",
"code": "theorem 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) :\n (∀ a b c d, p a b c d) ↔ ∀ a b c d, q a b c d",
"start": [
233,
1
],
"end": [
235,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "exists₄_congr",
"code": "theorem 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) :\n (∃ a b c d, p a b c d) ↔ ∃ a b c d, q a b c d",
"start": [
237,
1
],
"end": [
239,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "forall₅_congr",
"code": "theorem forall₅_congr {p q : ∀ a b c d, ε a b c d → Prop}\n (h : ∀ a b c d e, p a b c d e ↔ q a b c d e) :\n (∀ a b c d e, p a b c d e) ↔ ∀ a b c d e, q a b c d e",
"start": [
242,
1
],
"end": [
245,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "exists₅_congr",
"code": "theorem exists₅_congr {p q : ∀ a b c d, ε a b c d → Prop}\n (h : ∀ a b c d e, p a b c d e ↔ q a b c d e) :\n (∃ a b c d e, p a b c d e) ↔ ∃ a b c d e, q a b c d e",
"start": [
247,
1
],
"end": [
250,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "not_exists",
"code": "@[simp] theorem not_exists : (¬∃ x, p x) ↔ ∀ x, ¬p x",
"start": [
254,
1
],
"end": [
254,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_and",
"code": "theorem forall_and : (∀ x, p x ∧ q x) ↔ (∀ x, p x) ∧ (∀ x, q x)",
"start": [
256,
1
],
"end": [
257,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_or",
"code": "theorem exists_or : (∃ x, p x ∨ q x) ↔ (∃ x, p x) ∨ ∃ x, q x",
"start": [
259,
1
],
"end": [
261,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_false",
"code": "@[simp] theorem exists_false : ¬(∃ _a : α, False)",
"start": [
263,
1
],
"end": [
263,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_const",
"code": "@[simp] theorem forall_const (α : Sort _) [i : Nonempty α] : (α → b) ↔ b",
"start": [
265,
1
],
"end": [
266,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.nonempty",
"code": "theorem Exists.nonempty : (∃ x, p x) → Nonempty α",
"start": [
268,
1
],
"end": [
268,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "not_forall_of_exists_not",
"code": "theorem not_forall_of_exists_not {p : α → Prop} : (∃ x, ¬p x) → ¬∀ x, p x",
"start": [
270,
1
],
"end": [
271,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_eq",
"code": "@[simp] theorem forall_eq {p : α → Prop} {a' : α} : (∀ a, a = a' → p a) ↔ p a'",
"start": [
273,
1
],
"end": [
274,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_eq'",
"code": "@[simp] theorem forall_eq' {a' : α} : (∀ a, a' = a → p a) ↔ p a'",
"start": [
276,
1
],
"end": [
276,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq",
"code": "@[simp] theorem exists_eq : ∃ a, a = a'",
"start": [
278,
1
],
"end": [
278,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq'",
"code": "@[simp] theorem exists_eq' : ∃ a, a' = a",
"start": [
280,
1
],
"end": [
280,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_left",
"code": "@[simp] theorem exists_eq_left : (∃ a, a = a' ∧ p a) ↔ p a'",
"start": [
282,
1
],
"end": [
283,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_right",
"code": "@[simp] theorem exists_eq_right : (∃ a, p a ∧ a = a') ↔ p a'",
"start": [
285,
1
],
"end": [
286,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_and_left",
"code": "@[simp] theorem exists_and_left : (∃ x, b ∧ p x) ↔ b ∧ (∃ x, p x)",
"start": [
288,
1
],
"end": [
289,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_and_right",
"code": "@[simp] theorem exists_and_right : (∃ x, p x ∧ b) ↔ (∃ x, p x) ∧ b",
"start": [
291,
1
],
"end": [
291,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_left'",
"code": "@[simp] theorem exists_eq_left' : (∃ a, a' = a ∧ p a) ↔ p a'",
"start": [
293,
1
],
"end": [
293,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_eq_or_imp",
"code": "@[simp] theorem forall_eq_or_imp : (∀ a, a = a' ∨ q a → p a) ↔ p a' ∧ ∀ a, q a → p a",
"start": [
295,
1
],
"end": [
296,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_or_imp",
"code": "@[simp] theorem exists_eq_or_imp : (∃ a, (a = a' ∨ q a) ∧ p a) ↔ p a' ∨ ∃ a, q a ∧ p a",
"start": [
298,
1
],
"end": [
299,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_right_right",
"code": "@[simp] theorem exists_eq_right_right : (∃ (a : α), p a ∧ q a ∧ a = a') ↔ p a' ∧ q a'",
"start": [
301,
1
],
"end": [
302,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_eq_right_right'",
"code": "@[simp] theorem exists_eq_right_right' : (∃ (a : α), p a ∧ q a ∧ a' = a) ↔ p a' ∧ q a'",
"start": [
304,
1
],
"end": [
305,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_prop",
"code": "@[simp] theorem exists_prop : (∃ _h : a, b) ↔ a ∧ b",
"start": [
307,
1
],
"end": [
308,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_apply_eq_apply",
"code": "@[simp] theorem exists_apply_eq_apply (f : α → β) (a' : α) : ∃ a, f a = f a'",
"start": [
310,
1
],
"end": [
310,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_prop_of_true",
"code": "theorem forall_prop_of_true {p : Prop} {q : p → Prop} (h : p) : (∀ h' : p, q h') ↔ q h",
"start": [
312,
1
],
"end": [
313,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_comm",
"code": "theorem forall_comm {p : α → β → Prop} : (∀ a b, p a b) ↔ (∀ b a, p a b)",
"start": [
315,
1
],
"end": [
316,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_comm",
"code": "theorem exists_comm {p : α → β → Prop} : (∃ a b, p a b) ↔ (∃ b a, p a b)",
"start": [
318,
1
],
"end": [
319,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_apply_eq_imp_iff",
"code": "@[simp] theorem forall_apply_eq_imp_iff {f : α → β} {p : β → Prop} :\n (∀ b a, f a = b → p b) ↔ ∀ a, p (f a)",
"start": [
321,
1
],
"end": [
322,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_eq_apply_imp_iff",
"code": "@[simp] theorem forall_eq_apply_imp_iff {f : α → β} {p : β → Prop} :\n (∀ b a, b = f a → p b) ↔ ∀ a, p (f a)",
"start": [
324,
1
],
"end": [
325,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_apply_eq_imp_iff₂",
"code": "@[simp] theorem forall_apply_eq_imp_iff₂ {f : α → β} {p : α → Prop} {q : β → Prop} :\n (∀ b a, p a → f a = b → q b) ↔ ∀ a, p a → q (f a)",
"start": [
327,
1
],
"end": [
329,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_prop_of_false",
"code": "theorem forall_prop_of_false {p : Prop} {q : p → Prop} (hn : ¬p) : (∀ h' : p, q h') ↔ True",
"start": [
331,
1
],
"end": [
332,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_not",
"code": "@[simp] theorem Decidable.not_not [Decidable p] : ¬¬p ↔ p",
"start": [
338,
1
],
"end": [
338,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_not_self",
"code": "abbrev Decidable.or_not_self := em",
"start": [
340,
1
],
"end": [
341,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_or_self",
"code": "theorem Decidable.not_or_self (p : Prop) [h : Decidable p] : ¬p ∨ p",
"start": [
343,
1
],
"end": [
345,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.by_contra",
"code": "theorem Decidable.by_contra [Decidable p] : (¬p → False) → p",
"start": [
347,
1
],
"end": [
347,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.by_cases",
"code": "protected def Or.by_cases [Decidable p] {α : Sort u} (h : p ∨ q) (h₁ : p → α) (h₂ : q → α) : α :=\n if hp : p then h₁ hp else h₂ (h.resolve_left hp)",
"start": [
349,
1
],
"end": [
351,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Or.by_cases'",
"code": "protected def Or.by_cases' [Decidable q] {α : Sort u} (h : p ∨ q) (h₁ : p → α) (h₂ : q → α) : α :=\n if hq : q then h₂ hq else h₁ (h.resolve_right hq)",
"start": [
353,
1
],
"end": [
355,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "exists_prop_decidable",
"code": "instance exists_prop_decidable {p} (P : p → Prop)\n [Decidable p] [∀ h, Decidable (P h)] : Decidable (∃ h, P h) :=\nif h : p then\n decidable_of_decidable_of_iff ⟨fun h2 => ⟨h, h2⟩, fun ⟨_, h2⟩ => h2⟩\nelse isFalse fun ⟨h', _⟩ => h h'",
"start": [
357,
1
],
"end": [
361,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "forall_prop_decidable",
"code": "instance forall_prop_decidable {p} (P : p → Prop)\n [Decidable p] [∀ h, Decidable (P h)] : Decidable (∀ h, P h) :=\nif h : p then\n decidable_of_decidable_of_iff ⟨fun h2 _ => h2, fun al => al h⟩\nelse isTrue fun h2 => absurd h2 h",
"start": [
363,
1
],
"end": [
367,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_true_iff",
"code": "theorem decide_eq_true_iff (p : Prop) [Decidable p] : (decide p = true) ↔ p",
"start": [
369,
1
],
"end": [
369,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_false_iff_not",
"code": "@[simp] theorem decide_eq_false_iff_not (p : Prop) {_ : Decidable p} : (decide p = false) ↔ ¬p",
"start": [
371,
1
],
"end": [
372,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_eq_decide",
"code": "@[simp] theorem decide_eq_decide {p q : Prop} {_ : Decidable p} {_ : Decidable q} :\n decide p = decide q ↔ (p ↔ q)",
"start": [
374,
1
],
"end": [
376,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.of_not_imp",
"code": "theorem Decidable.of_not_imp [Decidable a] (h : ¬(a → b)) : a",
"start": [
378,
1
],
"end": [
379,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_imp_symm",
"code": "theorem Decidable.not_imp_symm [Decidable a] (h : ¬a → b) (hb : ¬b) : a",
"start": [
381,
1
],
"end": [
382,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_imp_comm",
"code": "theorem Decidable.not_imp_comm [Decidable a] [Decidable b] : (¬a → b) ↔ (¬b → a)",
"start": [
384,
1
],
"end": [
385,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_imp_self",
"code": "@[simp] theorem Decidable.not_imp_self [Decidable a] : (¬a → a) ↔ a",
"start": [
387,
1
],
"end": [
388,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_iff_not_imp_left",
"code": "theorem Decidable.or_iff_not_imp_left [Decidable a] : a ∨ b ↔ (¬a → b)",
"start": [
390,
1
],
"end": [
391,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_iff_not_imp_right",
"code": "theorem Decidable.or_iff_not_imp_right [Decidable b] : a ∨ b ↔ (¬b → a)",
"start": [
393,
1
],
"end": [
394,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_imp_not",
"code": "theorem Decidable.not_imp_not [Decidable a] : (¬a → ¬b) ↔ (b → a)",
"start": [
396,
1
],
"end": [
397,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_or_of_imp",
"code": "theorem Decidable.not_or_of_imp [Decidable a] (h : a → b) : ¬a ∨ b",
"start": [
399,
1
],
"end": [
400,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_iff_not_or",
"code": "theorem Decidable.imp_iff_not_or [Decidable a] : (a → b) ↔ (¬a ∨ b)",
"start": [
402,
1
],
"end": [
403,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_iff_or_not",
"code": "theorem Decidable.imp_iff_or_not [Decidable b] : b → a ↔ a ∨ ¬b",
"start": [
405,
1
],
"end": [
406,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_or",
"code": "theorem Decidable.imp_or [h : Decidable a] : (a → b ∨ c) ↔ (a → b) ∨ (a → c)",
"start": [
408,
1
],
"end": [
412,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_or'",
"code": "theorem Decidable.imp_or' [Decidable b] : (a → b ∨ c) ↔ (a → b) ∨ (a → c)",
"start": [
414,
1
],
"end": [
416,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_imp_iff_and_not",
"code": "theorem Decidable.not_imp_iff_and_not [Decidable a] : ¬(a → b) ↔ a ∧ ¬b",
"start": [
418,
1
],
"end": [
419,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.peirce",
"code": "theorem Decidable.peirce (a b : Prop) [Decidable a] : ((a → b) → a) → a",
"start": [
421,
1
],
"end": [
422,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "peirce'",
"code": "theorem peirce' {a : Prop} (H : ∀ b : Prop, (a → b) → a) : a",
"start": [
424,
1
],
"end": [
424,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_iff_not",
"code": "theorem Decidable.not_iff_not [Decidable a] [Decidable b] : (¬a ↔ ¬b) ↔ (a ↔ b)",
"start": [
426,
1
],
"end": [
427,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_iff_comm",
"code": "theorem Decidable.not_iff_comm [Decidable a] [Decidable b] : (¬a ↔ b) ↔ (¬b ↔ a)",
"start": [
429,
1
],
"end": [
430,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_iff",
"code": "theorem Decidable.not_iff [Decidable b] : ¬(a ↔ b) ↔ (¬a ↔ b)",
"start": [
432,
1
],
"end": [
436,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.iff_not_comm",
"code": "theorem Decidable.iff_not_comm [Decidable a] [Decidable b] : (a ↔ ¬b) ↔ (b ↔ ¬a)",
"start": [
438,
1
],
"end": [
439,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.iff_iff_and_or_not_and_not",
"code": "theorem Decidable.iff_iff_and_or_not_and_not {a b : Prop} [Decidable b] :\n (a ↔ b) ↔ (a ∧ b) ∨ (¬a ∧ ¬b)",
"start": [
441,
1
],
"end": [
444,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.iff_iff_not_or_and_or_not",
"code": "theorem Decidable.iff_iff_not_or_and_or_not [Decidable a] [Decidable b] :\n (a ↔ b) ↔ (¬a ∨ b) ∧ (a ∨ ¬b)",
"start": [
446,
1
],
"end": [
448,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_and_not_right",
"code": "theorem Decidable.not_and_not_right [Decidable b] : ¬(a ∧ ¬b) ↔ (a → b)",
"start": [
450,
1
],
"end": [
451,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_and_iff_or_not_not",
"code": "theorem Decidable.not_and_iff_or_not_not [Decidable a] : ¬(a ∧ b) ↔ ¬a ∨ ¬b",
"start": [
453,
1
],
"end": [
454,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_and_iff_or_not_not'",
"code": "theorem Decidable.not_and_iff_or_not_not' [Decidable b] : ¬(a ∧ b) ↔ ¬a ∨ ¬b",
"start": [
456,
1
],
"end": [
457,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_iff_not_and_not",
"code": "theorem Decidable.or_iff_not_and_not [Decidable a] [Decidable b] : a ∨ b ↔ ¬(¬a ∧ ¬b)",
"start": [
459,
1
],
"end": [
460,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.and_iff_not_or_not",
"code": "theorem Decidable.and_iff_not_or_not [Decidable a] [Decidable b] : a ∧ b ↔ ¬(¬a ∨ ¬b)",
"start": [
462,
1
],
"end": [
463,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_iff_right_iff",
"code": "theorem Decidable.imp_iff_right_iff [Decidable a] : (a → b ↔ b) ↔ a ∨ b",
"start": [
465,
1
],
"end": [
468,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.imp_iff_left_iff",
"code": "theorem Decidable.imp_iff_left_iff [Decidable a] : (b ↔ a → b) ↔ a ∨ b",
"start": [
470,
1
],
"end": [
471,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.and_or_imp",
"code": "theorem Decidable.and_or_imp [Decidable a] : a ∧ b ∨ (a → c) ↔ a → b ∨ c",
"start": [
473,
1
],
"end": [
475,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_congr_left'",
"code": "theorem Decidable.or_congr_left' [Decidable c] (h : ¬c → (a ↔ b)) : a ∨ c ↔ b ∨ c",
"start": [
477,
1
],
"end": [
478,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.or_congr_right'",
"code": "theorem Decidable.or_congr_right' [Decidable a] (h : ¬a → (b ↔ c)) : a ∨ b ↔ a ∨ c",
"start": [
480,
1
],
"end": [
481,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "decidable_of_iff",
"code": "@[inline] def decidable_of_iff (a : Prop) (h : a ↔ b) [Decidable a] : Decidable b :=\n decidable_of_decidable_of_iff h",
"start": [
483,
1
],
"end": [
488,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "decidable_of_iff'",
"code": "@[inline] def decidable_of_iff' (b : Prop) (h : a ↔ b) [Decidable b] : Decidable a :=\n decidable_of_decidable_of_iff h.symm",
"start": [
490,
1
],
"end": [
493,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.predToBool",
"code": "instance Decidable.predToBool (p : α → Prop) [DecidablePred p] :\n CoeDep (α → Prop) p (α → Bool) := ⟨fun b => decide <| p b⟩",
"start": [
495,
1
],
"end": [
496,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "decidable_of_bool",
"code": "def decidable_of_bool : ∀ (b : Bool), (b ↔ a) → Decidable a\n | true, h => isTrue (h.1 rfl)\n | false, h => isFalse (mt h.2 Bool.noConfusion)",
"start": [
498,
1
],
"end": [
502,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_forall",
"code": "protected theorem Decidable.not_forall {p : α → Prop} [Decidable (∃ x, ¬p x)]\n [∀ x, Decidable (p x)] : (¬∀ x, p x) ↔ ∃ x, ¬p x",
"start": [
504,
1
],
"end": [
507,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_forall_not",
"code": "protected theorem Decidable.not_forall_not {p : α → Prop} [Decidable (∃ x, p x)] :\n (¬∀ x, ¬p x) ↔ ∃ x, p x",
"start": [
509,
1
],
"end": [
511,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Decidable.not_exists_not",
"code": "protected theorem Decidable.not_exists_not {p : α → Prop} [∀ x, Decidable (p x)] :\n (¬∃ x, ¬p x) ↔ ∀ x, p x",
"start": [
513,
1
],
"end": [
515,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_implies",
"code": "@[simp]\ntheorem decide_implies (u v : Prop)\n [duv : Decidable (u → v)] [du : Decidable u] {dv : u → Decidable v}\n : decide (u → v) = dite u (fun h => @decide v (dv h)) (fun _ => true)",
"start": [
532,
1
],
"end": [
539,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "decide_ite",
"code": "@[simp]\ntheorem decide_ite (u : Prop) [du : Decidable u] (p q : Prop)\n [dpq : Decidable (ite u p q)] [dp : Decidable p] [dq : Decidable q] :\n decide (ite u p q) = ite u (decide p) (decide q)",
"start": [
551,
1
],
"end": [
555,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_true_decide_same",
"code": "@[simp] theorem ite_true_decide_same (p : Prop) [h : Decidable p] (b : Bool) :\n (if p then decide p else b) = (decide p || b)",
"start": [
558,
1
],
"end": [
560,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_false_decide_same",
"code": "@[simp] theorem ite_false_decide_same (p : Prop) [h : Decidable p] (b : Bool) :\n (if p then b else decide p) = (decide p && b)",
"start": [
563,
1
],
"end": [
565,
39
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Classical.lean | [
".lake/packages/lean4/src/lean/Init/PropLemmas.lean"
] | [
{
"full_name": "Classical.indefiniteDescription",
"code": "noncomputable def indefiniteDescription {α : Sort u} (p : α → Prop) (h : ∃ x, p x) : {x // p x} :=\n choice <| let ⟨x, px⟩ := h; ⟨⟨x, px⟩⟩",
"start": [
15,
1
],
"end": [
16,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.choose",
"code": "noncomputable def choose {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : α :=\n (indefiniteDescription p h).val",
"start": [
18,
1
],
"end": [
26,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.choose_spec",
"code": "theorem choose_spec {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : p (choose h)",
"start": [
28,
1
],
"end": [
29,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.em",
"code": "theorem em (p : Prop) : p ∨ ¬p",
"start": [
31,
1
],
"end": [
63,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.exists_true_of_nonempty",
"code": "theorem exists_true_of_nonempty {α : Sort u} : Nonempty α → ∃ _ : α, True",
"start": [
65,
1
],
"end": [
66,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.inhabited_of_nonempty",
"code": "noncomputable def inhabited_of_nonempty {α : Sort u} (h : Nonempty α) : Inhabited α :=\n ⟨choice h⟩",
"start": [
68,
1
],
"end": [
69,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.inhabited_of_exists",
"code": "noncomputable def inhabited_of_exists {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : Inhabited α :=\n inhabited_of_nonempty (Exists.elim h (fun w _ => ⟨w⟩))",
"start": [
71,
1
],
"end": [
72,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.propDecidable",
"code": "noncomputable scoped instance (priority := low) propDecidable (a : Prop) : Decidable a :=\n choice <| match em a with\n | Or.inl h => ⟨isTrue h⟩\n | Or.inr h => ⟨isFalse h⟩",
"start": [
74,
1
],
"end": [
78,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.decidableInhabited",
"code": "noncomputable def decidableInhabited (a : Prop) : Inhabited (Decidable a) where\n default := inferInstance",
"start": [
80,
1
],
"end": [
81,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.typeDecidableEq",
"code": "noncomputable def typeDecidableEq (α : Sort u) : DecidableEq α :=\n fun _ _ => inferInstance",
"start": [
83,
1
],
"end": [
84,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.typeDecidable",
"code": "noncomputable def typeDecidable (α : Sort u) : PSum α (α → False) :=\n match (propDecidable (Nonempty α)) with\n | (isTrue hp) => PSum.inl (@default _ (inhabited_of_nonempty hp))\n | (isFalse hn) => PSum.inr (fun a => absurd (Nonempty.intro a) hn)",
"start": [
86,
1
],
"end": [
89,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.strongIndefiniteDescription",
"code": "noncomputable def strongIndefiniteDescription {α : Sort u} (p : α → Prop) (h : Nonempty α) : {x : α // (∃ y : α, p y) → p x} :=\n @dite _ (∃ x : α, p x) (propDecidable _)\n (fun (hp : ∃ x : α, p x) =>\n show {x : α // (∃ y : α, p y) → p x} from\n let xp := indefiniteDescription _ hp;\n ⟨xp.val, fun _ => xp.property⟩)\n (fun hp => ⟨choice h, fun h => absurd h hp⟩)",
"start": [
91,
1
],
"end": [
97,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.epsilon",
"code": "noncomputable def epsilon {α : Sort u} [h : Nonempty α] (p : α → Prop) : α :=\n (strongIndefiniteDescription p h).val",
"start": [
99,
1
],
"end": [
101,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.epsilon_spec_aux",
"code": "theorem epsilon_spec_aux {α : Sort u} (h : Nonempty α) (p : α → Prop) : (∃ y, p y) → p (@epsilon α h p)",
"start": [
103,
1
],
"end": [
104,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.epsilon_spec",
"code": "theorem epsilon_spec {α : Sort u} {p : α → Prop} (hex : ∃ y, p y) : p (@epsilon α (nonempty_of_exists hex) p)",
"start": [
106,
1
],
"end": [
107,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.epsilon_singleton",
"code": "theorem epsilon_singleton {α : Sort u} (x : α) : @epsilon α ⟨x⟩ (fun y => y = x) = x",
"start": [
109,
1
],
"end": [
110,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.axiomOfChoice",
"code": "theorem axiomOfChoice {α : Sort u} {β : α → Sort v} {r : ∀ x, β x → Prop} (h : ∀ x, ∃ y, r x y) : ∃ (f : ∀ x, β x), ∀ x, r x (f x)",
"start": [
112,
1
],
"end": [
114,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.skolem",
"code": "theorem skolem {α : Sort u} {b : α → Sort v} {p : ∀ x, b x → Prop} : (∀ x, ∃ y, p x y) ↔ ∃ (f : ∀ x, b x), ∀ x, p x (f x)",
"start": [
116,
1
],
"end": [
117,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.propComplete",
"code": "theorem propComplete (a : Prop) : a = True ∨ a = False",
"start": [
119,
1
],
"end": [
122,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.byCases",
"code": "theorem byCases {p q : Prop} (hpq : p → q) (hnpq : ¬p → q) : q",
"start": [
125,
1
],
"end": [
126,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.byContradiction",
"code": "theorem byContradiction {p : Prop} (h : ¬p → False) : p",
"start": [
129,
1
],
"end": [
130,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_not",
"code": "@[simp] theorem not_not : ¬¬a ↔ a",
"start": [
132,
1
],
"end": [
135,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_forall",
"code": "@[simp low] theorem not_forall {p : α → Prop} : (¬∀ x, p x) ↔ ∃ x, ¬p x",
"start": [
137,
1
],
"end": [
137,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_forall_not",
"code": "theorem not_forall_not {p : α → Prop} : (¬∀ x, ¬p x) ↔ ∃ x, p x",
"start": [
139,
1
],
"end": [
139,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_exists_not",
"code": "theorem not_exists_not {p : α → Prop} : (¬∃ x, ¬p x) ↔ ∀ x, p x",
"start": [
140,
1
],
"end": [
140,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.forall_or_exists_not",
"code": "theorem forall_or_exists_not (P : α → Prop) : (∀ a, P a) ∨ ∃ a, ¬ P a",
"start": [
142,
1
],
"end": [
143,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.exists_or_forall_not",
"code": "theorem exists_or_forall_not (P : α → Prop) : (∃ a, P a) ∨ ∀ a, ¬ P a",
"start": [
144,
1
],
"end": [
145,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.or_iff_not_imp_left",
"code": "theorem or_iff_not_imp_left : a ∨ b ↔ (¬a → b)",
"start": [
147,
1
],
"end": [
147,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.or_iff_not_imp_right",
"code": "theorem or_iff_not_imp_right : a ∨ b ↔ (¬b → a)",
"start": [
148,
1
],
"end": [
148,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_imp_iff_and_not",
"code": "theorem not_imp_iff_and_not : ¬(a → b) ↔ a ∧ ¬b",
"start": [
150,
1
],
"end": [
150,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_and_iff_or_not_not",
"code": "theorem not_and_iff_or_not_not : ¬(a ∧ b) ↔ ¬a ∨ ¬b",
"start": [
152,
1
],
"end": [
152,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_iff",
"code": "theorem not_iff : ¬(a ↔ b) ↔ (¬a ↔ b)",
"start": [
154,
1
],
"end": [
154,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.imp_iff_left_iff",
"code": "@[simp] theorem imp_iff_left_iff : (b ↔ a → b) ↔ a ∨ b",
"start": [
156,
1
],
"end": [
156,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.imp_iff_right_iff",
"code": "@[simp] theorem imp_iff_right_iff : (a → b ↔ b) ↔ a ∨ b",
"start": [
157,
1
],
"end": [
157,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.and_or_imp",
"code": "@[simp] theorem and_or_imp : a ∧ b ∨ (a → c) ↔ a → b ∨ c",
"start": [
159,
1
],
"end": [
159,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.not_imp",
"code": "@[simp] theorem not_imp : ¬(a → b) ↔ a ∧ ¬b",
"start": [
161,
1
],
"end": [
161,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Classical.imp_and_neg_imp_iff",
"code": "@[simp] theorem imp_and_neg_imp_iff (p q : Prop) : (p → q) ∧ (¬p → q) ↔ q",
"start": [
163,
1
],
"end": [
165,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.choose",
"code": "@[reducible] noncomputable def Exists.choose {p : α → Prop} (P : ∃ a, p a) : α := Classical.choose P",
"start": [
172,
1
],
"end": [
174,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Exists.choose_spec",
"code": "theorem Exists.choose_spec {p : α → Prop} (P : ∃ a, p a) : p P.choose",
"start": [
176,
1
],
"end": [
177,
97
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/ByCases.lean | [
".lake/packages/lean4/src/lean/Init/Classical.lean"
] | [
{
"full_name": "if_true",
"code": "@[simp] theorem if_true {_ : Decidable True} (t e : α) : ite True t e = t",
"start": [
24,
1
],
"end": [
24,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "if_false",
"code": "@[simp] theorem if_false {_ : Decidable False} (t e : α) : ite False t e = e",
"start": [
26,
1
],
"end": [
26,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_id",
"code": "theorem ite_id [Decidable c] {α} (t : α) : (if c then t else t) = t",
"start": [
28,
1
],
"end": [
28,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "apply_dite",
"code": "theorem apply_dite (f : α → β) (P : Prop) [Decidable P] (x : P → α) (y : ¬P → α) :\n f (dite P x y) = dite P (fun h => f (x h)) (fun h => f (y h))",
"start": [
30,
1
],
"end": [
33,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "apply_ite",
"code": "theorem apply_ite (f : α → β) (P : Prop) [Decidable P] (x y : α) :\n f (ite P x y) = ite P (f x) (f y)",
"start": [
35,
1
],
"end": [
38,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_eq_left_iff",
"code": "@[simp] theorem dite_eq_left_iff {P : Prop} [Decidable P] {B : ¬ P → α} :\n dite P (fun _ => a) B = a ↔ ∀ h, B h = a",
"start": [
40,
1
],
"end": [
42,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_eq_right_iff",
"code": "@[simp] theorem dite_eq_right_iff {P : Prop} [Decidable P] {A : P → α} :\n (dite P A fun _ => b) = b ↔ ∀ h, A h = b",
"start": [
44,
1
],
"end": [
46,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_eq_left_iff",
"code": "@[simp] theorem ite_eq_left_iff {P : Prop} [Decidable P] : ite P a b = a ↔ ¬P → b = a",
"start": [
48,
1
],
"end": [
49,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_eq_right_iff",
"code": "@[simp] theorem ite_eq_right_iff {P : Prop} [Decidable P] : ite P a b = b ↔ P → a = b",
"start": [
51,
1
],
"end": [
52,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_eq_ite",
"code": "@[simp] theorem dite_eq_ite [Decidable P] : (dite P (fun _ => a) fun _ => b) = ite P a b",
"start": [
54,
1
],
"end": [
55,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_some_none_eq_none",
"code": "theorem ite_some_none_eq_none [Decidable P] :\n (if P then some x else none) = none ↔ ¬ P",
"start": [
58,
1
],
"end": [
61,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "ite_some_none_eq_some",
"code": "@[simp] theorem ite_some_none_eq_some [Decidable P] :\n (if P then some x else none) = some y ↔ P ∧ x = y",
"start": [
63,
1
],
"end": [
65,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_some_none_eq_none",
"code": "theorem dite_some_none_eq_none [Decidable P] {x : P → α} :\n (if h : P then some (x h) else none) = none ↔ ¬P",
"start": [
68,
1
],
"end": [
71,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "dite_some_none_eq_some",
"code": "@[simp] theorem dite_some_none_eq_some [Decidable P] {x : P → α} {y : α} :\n (if h : P then some (x h) else none) = some y ↔ ∃ h : P, x h = y",
"start": [
73,
1
],
"end": [
78,
44
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Prod.lean | [
".lake/packages/lean4/src/lean/Init/SimpLemmas.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/TacticsExtra.lean | [
".lake/packages/lean4/src/lean/Init/NotationExtra.lean",
".lake/packages/lean4/src/lean/Init/Tactics.lean"
] | [
{
"full_name": "Lean.Parser.Tactic.expandIfThenElse",
"code": "private def expandIfThenElse\n (ifTk thenTk elseTk pos neg : Syntax)\n (mkIf : Term → Term → MacroM Term) : MacroM (TSyntax `tactic) := do\n let mkCase tk holeOrTacticSeq mkName : MacroM (Term × Array (TSyntax `tactic)) := do\n if holeOrTacticSeq.isOfKind `Lean.Parser.Term.syntheticHole then\n pure (⟨holeOrTacticSeq⟩, #[])\n else if holeOrTacticSeq.isOfKind `Lean.Parser.Term.hole then\n pure (← mkName, #[])\n else\n let hole ← withFreshMacroScope mkName\n let holeId := hole.raw[1]\n let case ← (open TSyntax.Compat in `(tactic|\n case $holeId:ident =>%$tk\n with_annotate_state $tk skip\n $holeOrTacticSeq))\n pure (hole, #[case])\n let (posHole, posCase) ← mkCase thenTk pos `(?pos)\n let (negHole, negCase) ← mkCase elseTk neg `(?neg)\n `(tactic| ((open Classical in refine%$ifTk $(← mkIf posHole negHole)); $[$(posCase ++ negCase)]*))",
"start": [
15,
1
],
"end": [
34,
101
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/RCases.lean | [
".lake/packages/lean4/src/lean/Init/Meta.lean",
".lake/packages/lean4/src/lean/Init/Tactics.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/ToString/Macro.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/Meta.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Int/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/NotationExtra.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean",
".lake/packages/lean4/src/lean/Init/Conv.lean"
] | [
{
"full_name": "Int.subNatNat_of_sub_eq_zero",
"code": "theorem subNatNat_of_sub_eq_zero {m n : Nat} (h : n - m = 0) : subNatNat m n = ↑(m - n)",
"start": [
17,
1
],
"end": [
18,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_of_sub_eq_succ",
"code": "theorem subNatNat_of_sub_eq_succ {m n k : Nat} (h : n - m = succ k) : subNatNat m n = -[k+1]",
"start": [
20,
1
],
"end": [
21,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_zero",
"code": "@[simp] protected theorem neg_zero : -(0:Int) = 0",
"start": [
23,
1
],
"end": [
23,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_add",
"code": "@[norm_cast] theorem ofNat_add (n m : Nat) : (↑(n + m) : Int) = n + m",
"start": [
25,
1
],
"end": [
25,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul",
"code": "@[norm_cast] theorem ofNat_mul (n m : Nat) : (↑(n * m) : Int) = n * m",
"start": [
26,
1
],
"end": [
26,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_succ",
"code": "theorem ofNat_succ (n : Nat) : (succ n : Int) = n + 1",
"start": [
27,
1
],
"end": [
27,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_ofNat_zero",
"code": "@[local simp] theorem neg_ofNat_zero : -((0 : Nat) : Int) = 0",
"start": [
29,
1
],
"end": [
29,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_ofNat_succ",
"code": "@[local simp] theorem neg_ofNat_succ (n : Nat) : -(succ n : Int) = -[n+1]",
"start": [
30,
1
],
"end": [
30,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_negSucc",
"code": "@[local simp] theorem neg_negSucc (n : Nat) : -(-[n+1]) = succ n",
"start": [
31,
1
],
"end": [
31,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_coe",
"code": "theorem negSucc_coe (n : Nat) : -[n+1] = -↑(n + 1)",
"start": [
33,
1
],
"end": [
33,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat_eq",
"code": "theorem negOfNat_eq : negOfNat n = -ofNat n",
"start": [
35,
1
],
"end": [
35,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_def",
"code": "@[simp] theorem add_def {a b : Int} : Int.add a b = a + b",
"start": [
39,
1
],
"end": [
39,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_add_ofNat",
"code": "@[local simp] theorem ofNat_add_ofNat (m n : Nat) : (↑m + ↑n : Int) = ↑(m + n)",
"start": [
41,
1
],
"end": [
41,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_add_negSucc",
"code": "@[local simp] theorem ofNat_add_negSucc (m n : Nat) : ↑m + -[n+1] = subNatNat m (succ n)",
"start": [
42,
1
],
"end": [
42,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_add_ofNat",
"code": "@[local simp] theorem negSucc_add_ofNat (m n : Nat) : -[m+1] + ↑n = subNatNat n (succ m)",
"start": [
43,
1
],
"end": [
43,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_add_negSucc",
"code": "@[local simp] theorem negSucc_add_negSucc (m n : Nat) : -[m+1] + -[n+1] = -[succ (m + n) +1]",
"start": [
44,
1
],
"end": [
44,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_def",
"code": "@[simp] theorem mul_def {a b : Int} : Int.mul a b = a * b",
"start": [
46,
1
],
"end": [
46,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul_ofNat",
"code": "@[local simp] theorem ofNat_mul_ofNat (m n : Nat) : (↑m * ↑n : Int) = ↑(m * n)",
"start": [
48,
1
],
"end": [
48,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul_negSucc'",
"code": "@[local simp] theorem ofNat_mul_negSucc' (m n : Nat) : ↑m * -[n+1] = negOfNat (m * succ n)",
"start": [
49,
1
],
"end": [
49,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_ofNat'",
"code": "@[local simp] theorem negSucc_mul_ofNat' (m n : Nat) : -[m+1] * ↑n = negOfNat (succ m * n)",
"start": [
50,
1
],
"end": [
50,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_negSucc'",
"code": "@[local simp] theorem negSucc_mul_negSucc' (m n : Nat) :\n -[m+1] * -[n+1] = ofNat (succ m * succ n)",
"start": [
51,
1
],
"end": [
52,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_inj",
"code": "@[norm_cast] theorem ofNat_inj : ((m : Nat) : Int) = (n : Nat) ↔ m = n",
"start": [
56,
1
],
"end": [
56,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_eq_zero",
"code": "theorem ofNat_eq_zero : ((n : Nat) : Int) = 0 ↔ n = 0",
"start": [
58,
1
],
"end": [
58,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_ne_zero",
"code": "theorem ofNat_ne_zero : ((n : Nat) : Int) ≠ 0 ↔ n ≠ 0",
"start": [
60,
1
],
"end": [
60,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_inj",
"code": "theorem negSucc_inj : negSucc m = negSucc n ↔ m = n",
"start": [
62,
1
],
"end": [
62,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_eq",
"code": "theorem negSucc_eq (n : Nat) : -[n+1] = -((n : Int) + 1)",
"start": [
64,
1
],
"end": [
64,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_ne_zero",
"code": "@[simp] theorem negSucc_ne_zero (n : Nat) : -[n+1] ≠ 0",
"start": [
66,
1
],
"end": [
66,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_ne_negSucc",
"code": "@[simp] theorem zero_ne_negSucc (n : Nat) : 0 ≠ -[n+1]",
"start": [
68,
1
],
"end": [
68,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.Nat.cast_ofNat_Int",
"code": "@[simp, norm_cast] theorem Nat.cast_ofNat_Int :\n (Nat.cast (no_index (OfNat.ofNat n)) : Int) = OfNat.ofNat n",
"start": [
70,
1
],
"end": [
71,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_neg",
"code": "@[simp] protected theorem neg_neg : ∀ a : Int, -(-a) = a",
"start": [
75,
1
],
"end": [
78,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_inj",
"code": "protected theorem neg_inj {a b : Int} : -a = -b ↔ a = b",
"start": [
80,
1
],
"end": [
81,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_eq_zero",
"code": "@[simp] protected theorem neg_eq_zero : -a = 0 ↔ a = 0",
"start": [
83,
1
],
"end": [
83,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_ne_zero",
"code": "protected theorem neg_ne_zero : -a ≠ 0 ↔ a ≠ 0",
"start": [
85,
1
],
"end": [
85,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_eq_add_neg",
"code": "protected theorem sub_eq_add_neg {a b : Int} : a - b = a + -b",
"start": [
87,
1
],
"end": [
87,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg_one",
"code": "theorem add_neg_one (i : Int) : i + -1 = i - 1",
"start": [
89,
1
],
"end": [
89,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_elim",
"code": "theorem subNatNat_elim (m n : Nat) (motive : Nat → Nat → Int → Prop)\n (hp : ∀ i n, motive (n + i) n i)\n (hn : ∀ i m, motive m (m + i + 1) -[i+1]) :\n motive m n (subNatNat m n)",
"start": [
94,
1
],
"end": [
105,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_add_left",
"code": "theorem subNatNat_add_left : subNatNat (m + n) m = n",
"start": [
107,
1
],
"end": [
109,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_add_right",
"code": "theorem subNatNat_add_right : subNatNat m (m + n + 1) = negSucc n",
"start": [
111,
1
],
"end": [
112,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_add_add",
"code": "theorem subNatNat_add_add (m n k : Nat) : subNatNat (m + k) (n + k) = subNatNat m n",
"start": [
114,
1
],
"end": [
123,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_of_le",
"code": "theorem subNatNat_of_le {m n : Nat} (h : n ≤ m) : subNatNat m n = ↑(m - n)",
"start": [
125,
1
],
"end": [
126,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_of_lt",
"code": "theorem subNatNat_of_lt {m n : Nat} (h : m < n) : subNatNat m n = -[pred (n - m) +1]",
"start": [
128,
1
],
"end": [
129,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_comm",
"code": "protected theorem add_comm : ∀ a b : Int, a + b = b + a",
"start": [
135,
1
],
"end": [
139,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_zero",
"code": "@[simp] protected theorem add_zero : ∀ a : Int, a + 0 = a",
"start": [
142,
1
],
"end": [
144,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_add",
"code": "@[simp] protected theorem zero_add (a : Int) : 0 + a = a",
"start": [
146,
1
],
"end": [
146,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_add_negSucc_of_lt",
"code": "theorem ofNat_add_negSucc_of_lt (h : m < n.succ) : ofNat m + -[n+1] = -[n - m+1]",
"start": [
151,
1
],
"end": [
152,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_sub",
"code": "theorem subNatNat_sub (h : n ≤ m) (k : Nat) : subNatNat (m - n) k = subNatNat m (k + n)",
"start": [
154,
1
],
"end": [
155,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_add",
"code": "theorem subNatNat_add (m n k : Nat) : subNatNat (m + n) k = m + subNatNat n k",
"start": [
157,
1
],
"end": [
164,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_add_negSucc",
"code": "theorem subNatNat_add_negSucc (m n k : Nat) :\n subNatNat m n + -[k+1] = subNatNat m (n + succ k)",
"start": [
166,
1
],
"end": [
180,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_assoc",
"code": "protected theorem add_assoc : ∀ a b c : Int, a + b + c = a + (b + c)",
"start": [
182,
1
],
"end": [
202,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_left_comm",
"code": "protected theorem add_left_comm (a b c : Int) : a + (b + c) = b + (a + c)",
"start": [
205,
1
],
"end": [
206,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_right_comm",
"code": "protected theorem add_right_comm (a b c : Int) : a + b + c = a + c + b",
"start": [
208,
1
],
"end": [
209,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_self",
"code": "theorem subNatNat_self : ∀ n, subNatNat n n = 0",
"start": [
213,
1
],
"end": [
215,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_left_neg",
"code": "@[local simp] protected theorem add_left_neg : ∀ a : Int, -a + a = 0",
"start": [
219,
1
],
"end": [
222,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_right_neg",
"code": "@[local simp] protected theorem add_right_neg (a : Int) : a + -a = 0",
"start": [
224,
1
],
"end": [
225,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_eq_of_add_eq_zero",
"code": "@[simp] protected theorem neg_eq_of_add_eq_zero {a b : Int} (h : a + b = 0) : -a = b",
"start": [
227,
1
],
"end": [
228,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_neg_of_eq_neg",
"code": "protected theorem eq_neg_of_eq_neg {a b : Int} (h : a = -b) : b = -a",
"start": [
230,
1
],
"end": [
231,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_neg_comm",
"code": "protected theorem eq_neg_comm {a b : Int} : a = -b ↔ b = -a",
"start": [
233,
1
],
"end": [
234,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_eq_comm",
"code": "protected theorem neg_eq_comm {a b : Int} : -a = b ↔ -b = a",
"start": [
236,
1
],
"end": [
237,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_cancel_left",
"code": "protected theorem neg_add_cancel_left (a b : Int) : -a + (a + b) = b",
"start": [
239,
1
],
"end": [
240,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg_cancel_left",
"code": "protected theorem add_neg_cancel_left (a b : Int) : a + (-a + b) = b",
"start": [
242,
1
],
"end": [
243,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg_cancel_right",
"code": "protected theorem add_neg_cancel_right (a b : Int) : a + b + -b = a",
"start": [
245,
1
],
"end": [
246,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_cancel_right",
"code": "protected theorem neg_add_cancel_right (a b : Int) : a + -b + b = a",
"start": [
248,
1
],
"end": [
249,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_left_cancel",
"code": "protected theorem add_left_cancel {a b c : Int} (h : a + b = a + c) : b = c",
"start": [
251,
1
],
"end": [
253,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add",
"code": "@[local simp] protected theorem neg_add {a b : Int} : -(a + b) = -a + -b",
"start": [
255,
1
],
"end": [
258,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_sub_one",
"code": "@[simp] theorem negSucc_sub_one (n : Nat) : -[n+1] - 1 = -[n + 1 +1]",
"start": [
262,
1
],
"end": [
262,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_self",
"code": "@[simp] protected theorem sub_self (a : Int) : a - a = 0",
"start": [
264,
1
],
"end": [
265,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_zero",
"code": "@[simp] protected theorem sub_zero (a : Int) : a - 0 = a",
"start": [
267,
1
],
"end": [
267,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_sub",
"code": "@[simp] protected theorem zero_sub (a : Int) : 0 - a = -a",
"start": [
269,
1
],
"end": [
269,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_eq_zero_of_eq",
"code": "protected theorem sub_eq_zero_of_eq {a b : Int} (h : a = b) : a - b = 0",
"start": [
271,
1
],
"end": [
272,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_of_sub_eq_zero",
"code": "protected theorem eq_of_sub_eq_zero {a b : Int} (h : a - b = 0) : a = b",
"start": [
274,
1
],
"end": [
277,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_eq_zero",
"code": "protected theorem sub_eq_zero {a b : Int} : a - b = 0 ↔ a = b",
"start": [
279,
1
],
"end": [
280,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_sub",
"code": "protected theorem sub_sub (a b c : Int) : a - b - c = a - (b + c)",
"start": [
282,
1
],
"end": [
283,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_sub",
"code": "protected theorem neg_sub (a b : Int) : -(a - b) = b - a",
"start": [
285,
1
],
"end": [
286,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_sub_self",
"code": "protected theorem sub_sub_self (a b : Int) : a - (a - b) = b",
"start": [
288,
1
],
"end": [
289,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_neg",
"code": "protected theorem sub_neg (a b : Int) : a - -b = a + b",
"start": [
291,
1
],
"end": [
291,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_add_cancel",
"code": "@[simp] protected theorem sub_add_cancel (a b : Int) : a - b + b = a",
"start": [
293,
1
],
"end": [
294,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_sub_cancel",
"code": "@[simp] protected theorem add_sub_cancel (a b : Int) : a + b - b = a",
"start": [
296,
1
],
"end": [
297,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_sub_assoc",
"code": "protected theorem add_sub_assoc (a b c : Int) : a + b - c = a + (b - c)",
"start": [
299,
1
],
"end": [
300,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_sub",
"code": "@[norm_cast] theorem ofNat_sub (h : m ≤ n) : ((n - m : Nat) : Int) = n - m",
"start": [
302,
1
],
"end": [
307,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_coe'",
"code": "theorem negSucc_coe' (n : Nat) : -[n+1] = -↑n - 1",
"start": [
309,
1
],
"end": [
310,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.subNatNat_eq_coe",
"code": "protected theorem subNatNat_eq_coe {m n : Nat} : subNatNat m n = ↑m - ↑n",
"start": [
312,
1
],
"end": [
320,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_sub",
"code": "theorem toNat_sub (m n : Nat) : toNat (m - n) = m - n",
"start": [
322,
1
],
"end": [
326,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_right_inj",
"code": "@[simp]\nprotected theorem add_right_inj (i j k : Int) : (i + k = j + k) ↔ i = j",
"start": [
330,
1
],
"end": [
335,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_left_inj",
"code": "@[simp]\nprotected theorem add_left_inj (i j k : Int) : (k + i = k + j) ↔ i = j",
"start": [
337,
1
],
"end": [
339,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_left_inj",
"code": "@[simp]\nprotected theorem sub_left_inj (i j k : Int) : (k - i = k - j) ↔ i = j",
"start": [
341,
1
],
"end": [
343,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_right_inj",
"code": "@[simp]\nprotected theorem sub_right_inj (i j k : Int) : (i - k = j - k) ↔ i = j",
"start": [
345,
1
],
"end": [
347,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul_negSucc",
"code": "@[simp] theorem ofNat_mul_negSucc (m n : Nat) : (m : Int) * -[n+1] = -↑(m * succ n)",
"start": [
351,
1
],
"end": [
351,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_ofNat",
"code": "@[simp] theorem negSucc_mul_ofNat (m n : Nat) : -[m+1] * n = -↑(succ m * n)",
"start": [
353,
1
],
"end": [
353,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_negSucc",
"code": "@[simp] theorem negSucc_mul_negSucc (m n : Nat) : -[m+1] * -[n+1] = succ m * succ n",
"start": [
355,
1
],
"end": [
355,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_comm",
"code": "protected theorem mul_comm (a b : Int) : a * b = b * a",
"start": [
357,
1
],
"end": [
358,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul_negOfNat",
"code": "theorem ofNat_mul_negOfNat (m n : Nat) : (m : Nat) * negOfNat n = negOfNat (m * n)",
"start": [
361,
1
],
"end": [
362,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat_mul_ofNat",
"code": "theorem negOfNat_mul_ofNat (m n : Nat) : negOfNat m * (n : Nat) = negOfNat (m * n)",
"start": [
364,
1
],
"end": [
365,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_negOfNat",
"code": "theorem negSucc_mul_negOfNat (m n : Nat) : -[m+1] * negOfNat n = ofNat (succ m * n)",
"start": [
367,
1
],
"end": [
368,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat_mul_negSucc",
"code": "theorem negOfNat_mul_negSucc (m n : Nat) : negOfNat n * -[m+1] = ofNat (n * succ m)",
"start": [
370,
1
],
"end": [
371,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_assoc",
"code": "protected theorem mul_assoc (a b c : Int) : a * b * c = a * (b * c)",
"start": [
376,
1
],
"end": [
377,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_left_comm",
"code": "protected theorem mul_left_comm (a b c : Int) : a * (b * c) = b * (a * c)",
"start": [
380,
1
],
"end": [
381,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_right_comm",
"code": "protected theorem mul_right_comm (a b c : Int) : a * b * c = a * c * b",
"start": [
383,
1
],
"end": [
384,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_zero",
"code": "@[simp] protected theorem mul_zero (a : Int) : a * 0 = 0",
"start": [
386,
1
],
"end": [
386,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_mul",
"code": "@[simp] protected theorem zero_mul (a : Int) : 0 * a = 0",
"start": [
388,
1
],
"end": [
388,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat_eq_subNatNat_zero",
"code": "theorem negOfNat_eq_subNatNat_zero (n) : negOfNat n = subNatNat 0 n",
"start": [
390,
1
],
"end": [
390,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mul_subNatNat",
"code": "theorem ofNat_mul_subNatNat (m n k : Nat) :\n m * subNatNat n k = subNatNat (m * n) (m * k)",
"start": [
392,
1
],
"end": [
404,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negOfNat_add",
"code": "theorem negOfNat_add (m n : Nat) : negOfNat m + negOfNat n = negOfNat (m + n)",
"start": [
406,
1
],
"end": [
407,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_mul_subNatNat",
"code": "theorem negSucc_mul_subNatNat (m n k : Nat) :\n -[m+1] * subNatNat n k = subNatNat (succ m * k) (succ m * n)",
"start": [
409,
1
],
"end": [
421,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_add",
"code": "protected theorem mul_add : ∀ a b c : Int, a * (b + c) = a * b + a * c",
"start": [
425,
1
],
"end": [
436,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_mul",
"code": "protected theorem add_mul (a b c : Int) : (a + b) * c = a * c + b * c",
"start": [
438,
1
],
"end": [
439,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_mul_eq_neg_mul",
"code": "protected theorem neg_mul_eq_neg_mul (a b : Int) : -(a * b) = -a * b",
"start": [
441,
1
],
"end": [
442,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_mul_eq_mul_neg",
"code": "protected theorem neg_mul_eq_mul_neg (a b : Int) : -(a * b) = a * -b",
"start": [
444,
1
],
"end": [
445,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_mul",
"code": "@[local simp] protected theorem neg_mul (a b : Int) : -a * b = -(a * b)",
"start": [
447,
1
],
"end": [
448,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_neg",
"code": "@[local simp] protected theorem mul_neg (a b : Int) : a * -b = -(a * b)",
"start": [
450,
1
],
"end": [
451,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_mul_neg",
"code": "protected theorem neg_mul_neg (a b : Int) : -a * -b = a * b",
"start": [
453,
1
],
"end": [
453,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_mul_comm",
"code": "protected theorem neg_mul_comm (a b : Int) : -a * b = a * -b",
"start": [
455,
1
],
"end": [
455,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_sub",
"code": "protected theorem mul_sub (a b c : Int) : a * (b - c) = a * b - a * c",
"start": [
457,
1
],
"end": [
458,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_mul",
"code": "protected theorem sub_mul (a b c : Int) : (a - b) * c = a * c - b * c",
"start": [
460,
1
],
"end": [
461,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.one_mul",
"code": "@[simp] protected theorem one_mul : ∀ a : Int, 1 * a = a",
"start": [
463,
1
],
"end": [
465,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_one",
"code": "@[simp] protected theorem mul_one (a : Int) : a * 1 = a",
"start": [
467,
1
],
"end": [
467,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_neg_one",
"code": "protected theorem mul_neg_one (a : Int) : a * -1 = -a",
"start": [
472,
1
],
"end": [
472,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_eq_neg_one_mul",
"code": "protected theorem neg_eq_neg_one_mul : ∀ a : Int, -a = -1 * a",
"start": [
474,
1
],
"end": [
477,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_eq_zero",
"code": "protected theorem mul_eq_zero {a b : Int} : a * b = 0 ↔ a = 0 ∨ b = 0",
"start": [
479,
1
],
"end": [
484,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ne_zero",
"code": "protected theorem mul_ne_zero {a b : Int} (a0 : a ≠ 0) (b0 : b ≠ 0) : a * b ≠ 0",
"start": [
486,
1
],
"end": [
487,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_of_mul_eq_mul_right",
"code": "protected theorem eq_of_mul_eq_mul_right {a b c : Int} (ha : a ≠ 0) (h : b * a = c * a) : b = c",
"start": [
489,
1
],
"end": [
491,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_of_mul_eq_mul_left",
"code": "protected theorem eq_of_mul_eq_mul_left {a b c : Int} (ha : a ≠ 0) (h : a * b = a * c) : b = c",
"start": [
493,
1
],
"end": [
497,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_eq_mul_left_iff",
"code": "theorem mul_eq_mul_left_iff {a b c : Int} (h : c ≠ 0) : c * a = c * b ↔ a = b",
"start": [
499,
1
],
"end": [
500,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_eq_mul_right_iff",
"code": "theorem mul_eq_mul_right_iff {a b c : Int} (h : c ≠ 0) : a * c = b * c ↔ a = b",
"start": [
502,
1
],
"end": [
503,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_one_of_mul_eq_self_left",
"code": "theorem eq_one_of_mul_eq_self_left {a b : Int} (Hpos : a ≠ 0) (H : b * a = a) : b = 1",
"start": [
505,
1
],
"end": [
506,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_one_of_mul_eq_self_right",
"code": "theorem eq_one_of_mul_eq_self_right {a b : Int} (Hpos : b ≠ 0) (H : b * a = b) : a = 1",
"start": [
508,
1
],
"end": [
509,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natCast_zero",
"code": "theorem natCast_zero : ((0 : Nat) : Int) = (0 : Int)",
"start": [
518,
1
],
"end": [
518,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natCast_one",
"code": "theorem natCast_one : ((1 : Nat) : Int) = (1 : Int)",
"start": [
520,
1
],
"end": [
520,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natCast_add",
"code": "@[simp] theorem natCast_add (a b : Nat) : ((a + b : Nat) : Int) = (a : Int) + (b : Int)",
"start": [
522,
1
],
"end": [
525,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natCast_mul",
"code": "@[simp] theorem natCast_mul (a b : Nat) : ((a * b : Nat) : Int) = (a : Int) * (b : Int)",
"start": [
527,
1
],
"end": [
528,
7
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/BinderPredicates.lean | [
".lake/packages/lean4/src/lean/Init/NotationExtra.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean | [
".lake/packages/lean4/src/lean/Init/Data/Prod.lean",
".lake/packages/lean4/src/lean/Init/ByCases.lean"
] | [
{
"full_name": "Nat.Linear.Var",
"code": "abbrev Var := Nat",
"start": [
16,
1
],
"end": [
16,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Context",
"code": "abbrev Context := List Nat",
"start": [
18,
1
],
"end": [
18,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.fixedVar",
"code": "def fixedVar := 100000000",
"start": [
20,
1
],
"end": [
23,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Var.denote",
"code": "def Var.denote (ctx : Context) (v : Var) : Nat :=\n bif v == fixedVar then 1 else go ctx v\nwhere\n go : List Nat → Nat → Nat\n | [], _ => 0\n | a::_, 0 => a\n | _::as, i+1 => go as i",
"start": [
25,
1
],
"end": [
31,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr",
"code": "inductive Expr where\n | num (v : Nat)\n | var (i : Var)\n | add (a b : Expr)\n | mulL (k : Nat) (a : Expr)\n | mulR (a : Expr) (k : Nat)\n deriving Inhabited",
"start": [
33,
1
],
"end": [
39,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.denote",
"code": "def Expr.denote (ctx : Context) : Expr → Nat\n | Expr.add a b => Nat.add (denote ctx a) (denote ctx b)\n | Expr.num k => k\n | Expr.var v => v.denote ctx\n | Expr.mulL k e => Nat.mul k (denote ctx e)\n | Expr.mulR e k => Nat.mul (denote ctx e) k",
"start": [
41,
1
],
"end": [
46,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly",
"code": "abbrev Poly := List (Nat × Var)",
"start": [
48,
1
],
"end": [
48,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote",
"code": "def Poly.denote (ctx : Context) (p : Poly) : Nat :=\n match p with\n | [] => 0\n | (k, v) :: p => Nat.add (Nat.mul k (v.denote ctx)) (denote ctx p)",
"start": [
50,
1
],
"end": [
53,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.insertSorted",
"code": "def Poly.insertSorted (k : Nat) (v : Var) (p : Poly) : Poly :=\n match p with\n | [] => [(k, v)]\n | (k', v') :: p => bif Nat.blt v v' then (k, v) :: (k', v') :: p else (k', v') :: insertSorted k v p",
"start": [
55,
1
],
"end": [
58,
103
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.sort",
"code": "def Poly.sort (p : Poly) : Poly :=\n let rec go (p : Poly) (r : Poly) : Poly :=\n match p with\n | [] => r\n | (k, v) :: p => go p (r.insertSorted k v)\n go p []",
"start": [
60,
1
],
"end": [
65,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.fuse",
"code": "def Poly.fuse (p : Poly) : Poly :=\n match p with\n | [] => []\n | (k, v) :: p =>\n match fuse p with\n | [] => [(k, v)]\n | (k', v') :: p' => bif v == v' then (Nat.add k k', v)::p' else (k, v) :: (k', v') :: p'",
"start": [
67,
1
],
"end": [
73,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.mul",
"code": "def Poly.mul (k : Nat) (p : Poly) : Poly :=\n bif k == 0 then\n []\n else bif k == 1 then\n p\n else\n go p\nwhere\n go : Poly → Poly\n | [] => []\n | (k', v) :: p => (Nat.mul k k', v) :: go p",
"start": [
75,
1
],
"end": [
85,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.cancelAux",
"code": "def Poly.cancelAux (fuel : Nat) (m₁ m₂ r₁ r₂ : Poly) : Poly × Poly :=\n match fuel with\n | 0 => (r₁.reverse ++ m₁, r₂.reverse ++ m₂)\n | fuel + 1 =>\n match m₁, m₂ with\n | m₁, [] => (r₁.reverse ++ m₁, r₂.reverse)\n | [], m₂ => (r₁.reverse, r₂.reverse ++ m₂)\n | (k₁, v₁) :: m₁, (k₂, v₂) :: m₂ =>\n bif Nat.blt v₁ v₂ then\n cancelAux fuel m₁ ((k₂, v₂) :: m₂) ((k₁, v₁) :: r₁) r₂\n else bif Nat.blt v₂ v₁ then\n cancelAux fuel ((k₁, v₁) :: m₁) m₂ r₁ ((k₂, v₂) :: r₂)\n else bif Nat.blt k₁ k₂ then\n cancelAux fuel m₁ m₂ r₁ ((Nat.sub k₂ k₁, v₁) :: r₂)\n else bif Nat.blt k₂ k₁ then\n cancelAux fuel m₁ m₂ ((Nat.sub k₁ k₂, v₁) :: r₁) r₂\n else\n cancelAux fuel m₁ m₂ r₁ r₂",
"start": [
87,
1
],
"end": [
104,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.hugeFuel",
"code": "def hugeFuel := 1000000",
"start": [
106,
1
],
"end": [
106,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.cancel",
"code": "def Poly.cancel (p₁ p₂ : Poly) : Poly × Poly :=\n cancelAux hugeFuel p₁ p₂ [] []",
"start": [
108,
1
],
"end": [
109,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.isNum?",
"code": "def Poly.isNum? (p : Poly) : Option Nat :=\n match p with\n | [] => some 0\n | [(k, v)] => bif v == fixedVar then some k else none\n | _ => none",
"start": [
111,
1
],
"end": [
115,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.isZero",
"code": "def Poly.isZero (p : Poly) : Bool :=\n match p with\n | [] => true\n | _ => false",
"start": [
117,
1
],
"end": [
120,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.isNonZero",
"code": "def Poly.isNonZero (p : Poly) : Bool :=\n match p with\n | [] => false\n | (k, v) :: p => bif v == fixedVar then k > 0 else isNonZero p",
"start": [
122,
1
],
"end": [
125,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_eq",
"code": "def Poly.denote_eq (ctx : Context) (mp : Poly × Poly) : Prop := mp.1.denote ctx = mp.2.denote ctx",
"start": [
127,
1
],
"end": [
127,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_le",
"code": "def Poly.denote_le (ctx : Context) (mp : Poly × Poly) : Prop := mp.1.denote ctx ≤ mp.2.denote ctx",
"start": [
129,
1
],
"end": [
129,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.combineAux",
"code": "def Poly.combineAux (fuel : Nat) (p₁ p₂ : Poly) : Poly :=\n match fuel with\n | 0 => p₁ ++ p₂\n | fuel + 1 =>\n match p₁, p₂ with\n | p₁, [] => p₁\n | [], p₂ => p₂\n | (k₁, v₁) :: p₁, (k₂, v₂) :: p₂ =>\n bif Nat.blt v₁ v₂ then\n (k₁, v₁) :: combineAux fuel p₁ ((k₂, v₂) :: p₂)\n else bif Nat.blt v₂ v₁ then\n (k₂, v₂) :: combineAux fuel ((k₁, v₁) :: p₁) p₂\n else\n (Nat.add k₁ k₂, v₁) :: combineAux fuel p₁ p₂",
"start": [
131,
1
],
"end": [
144,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.combine",
"code": "def Poly.combine (p₁ p₂ : Poly) : Poly :=\n combineAux hugeFuel p₁ p₂",
"start": [
146,
1
],
"end": [
147,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.toPoly",
"code": "def Expr.toPoly : Expr → Poly\n | Expr.num k => bif k == 0 then [] else [ (k, fixedVar) ]\n | Expr.var i => [(1, i)]\n | Expr.add a b => a.toPoly ++ b.toPoly\n | Expr.mulL k a => a.toPoly.mul k\n | Expr.mulR a k => a.toPoly.mul k",
"start": [
149,
1
],
"end": [
154,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.norm",
"code": "def Poly.norm (p : Poly) : Poly :=\n p.sort.fuse",
"start": [
156,
1
],
"end": [
157,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.toNormPoly",
"code": "def Expr.toNormPoly (e : Expr) : Poly :=\n e.toPoly.norm",
"start": [
159,
1
],
"end": [
160,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.inc",
"code": "def Expr.inc (e : Expr) : Expr :=\n Expr.add e (Expr.num 1)",
"start": [
162,
1
],
"end": [
163,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr",
"code": "structure PolyCnstr where\n eq : Bool\n lhs : Poly\n rhs : Poly\n deriving BEq",
"start": [
165,
1
],
"end": [
169,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.mul",
"code": "def PolyCnstr.mul (k : Nat) (c : PolyCnstr) : PolyCnstr :=\n { c with lhs := c.lhs.mul k, rhs := c.rhs.mul k }",
"start": [
185,
1
],
"end": [
186,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.combine",
"code": "def PolyCnstr.combine (c₁ c₂ : PolyCnstr) : PolyCnstr :=\n let (lhs, rhs) := Poly.cancel (c₁.lhs.combine c₂.lhs) (c₁.rhs.combine c₂.rhs)\n { eq := c₁.eq && c₂.eq, lhs, rhs }",
"start": [
188,
1
],
"end": [
190,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr",
"code": "structure ExprCnstr where\n eq : Bool\n lhs : Expr\n rhs : Expr",
"start": [
192,
1
],
"end": [
195,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.denote",
"code": "def PolyCnstr.denote (ctx : Context) (c : PolyCnstr) : Prop :=\n bif c.eq then\n Poly.denote_eq ctx (c.lhs, c.rhs)\n else\n Poly.denote_le ctx (c.lhs, c.rhs)",
"start": [
197,
1
],
"end": [
201,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.norm",
"code": "def PolyCnstr.norm (c : PolyCnstr) : PolyCnstr :=\n let (lhs, rhs) := Poly.cancel c.lhs.sort.fuse c.rhs.sort.fuse\n { eq := c.eq, lhs, rhs }",
"start": [
203,
1
],
"end": [
205,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.isUnsat",
"code": "def PolyCnstr.isUnsat (c : PolyCnstr) : Bool :=\n bif c.eq then\n (c.lhs.isZero && c.rhs.isNonZero) || (c.lhs.isNonZero && c.rhs.isZero)\n else\n c.lhs.isNonZero && c.rhs.isZero",
"start": [
207,
1
],
"end": [
211,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.isValid",
"code": "def PolyCnstr.isValid (c : PolyCnstr) : Bool :=\n bif c.eq then\n c.lhs.isZero && c.rhs.isZero\n else\n c.lhs.isZero",
"start": [
213,
1
],
"end": [
217,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.denote",
"code": "def ExprCnstr.denote (ctx : Context) (c : ExprCnstr) : Prop :=\n bif c.eq then\n c.lhs.denote ctx = c.rhs.denote ctx\n else\n c.lhs.denote ctx ≤ c.rhs.denote ctx",
"start": [
219,
1
],
"end": [
223,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.toPoly",
"code": "def ExprCnstr.toPoly (c : ExprCnstr) : PolyCnstr :=\n { c with lhs := c.lhs.toPoly, rhs := c.rhs.toPoly }",
"start": [
225,
1
],
"end": [
226,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.toNormPoly",
"code": "def ExprCnstr.toNormPoly (c : ExprCnstr) : PolyCnstr :=\n let (lhs, rhs) := Poly.cancel c.lhs.toNormPoly c.rhs.toNormPoly\n { c with lhs, rhs }",
"start": [
228,
1
],
"end": [
230,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate",
"code": "abbrev Certificate := List (Nat × ExprCnstr)",
"start": [
232,
1
],
"end": [
232,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.combineHyps",
"code": "def Certificate.combineHyps (c : PolyCnstr) (hs : Certificate) : PolyCnstr :=\n match hs with\n | [] => c\n | (k, c') :: hs => combineHyps (PolyCnstr.combine c (c'.toNormPoly.mul (Nat.add k 1))) hs",
"start": [
234,
1
],
"end": [
237,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.combine",
"code": "def Certificate.combine (hs : Certificate) : PolyCnstr :=\n match hs with\n | [] => { eq := true, lhs := [], rhs := [] }\n | (k, c) :: hs => combineHyps (c.toNormPoly.mul (Nat.add k 1)) hs",
"start": [
239,
1
],
"end": [
242,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.denote",
"code": "def Certificate.denote (ctx : Context) (c : Certificate) : Prop :=\n match c with\n | [] => False\n | (_, c)::hs => c.denote ctx → denote ctx hs",
"start": [
244,
1
],
"end": [
247,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.monomialToExpr",
"code": "def monomialToExpr (k : Nat) (v : Var) : Expr :=\n bif v == fixedVar then\n Expr.num k\n else bif k == 1 then\n Expr.var v\n else\n Expr.mulL k (Expr.var v)",
"start": [
249,
1
],
"end": [
255,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.toExpr",
"code": "def Poly.toExpr (p : Poly) : Expr :=\n match p with\n | [] => Expr.num 0\n | (k, v) :: p => go (monomialToExpr k v) p\nwhere\n go (e : Expr) (p : Poly) : Expr :=\n match p with\n | [] => e\n | (k, v) :: p => go (Expr.add e (monomialToExpr k v)) p",
"start": [
257,
1
],
"end": [
265,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.toExpr",
"code": "def PolyCnstr.toExpr (c : PolyCnstr) : ExprCnstr :=\n { c with lhs := c.lhs.toExpr, rhs := c.rhs.toExpr }",
"start": [
267,
1
],
"end": [
268,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_insertSorted",
"code": "theorem Poly.denote_insertSorted (ctx : Context) (k : Nat) (v : Var) (p : Poly) : (p.insertSorted k v).denote ctx = p.denote ctx + k * v.denote ctx",
"start": [
274,
1
],
"end": [
277,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_sort_go",
"code": "theorem Poly.denote_sort_go (ctx : Context) (p : Poly) (r : Poly) : (sort.go p r).denote ctx = p.denote ctx + r.denote ctx",
"start": [
281,
1
],
"end": [
284,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_sort",
"code": "theorem Poly.denote_sort (ctx : Context) (m : Poly) : m.sort.denote ctx = m.denote ctx",
"start": [
288,
1
],
"end": [
289,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_append",
"code": "theorem Poly.denote_append (ctx : Context) (p q : Poly) : (p ++ q).denote ctx = p.denote ctx + q.denote ctx",
"start": [
293,
1
],
"end": [
296,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_cons",
"code": "theorem Poly.denote_cons (ctx : Context) (k : Nat) (v : Var) (p : Poly) : denote ctx ((k, v) :: p) = k * v.denote ctx + p.denote ctx",
"start": [
300,
1
],
"end": [
303,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_reverseAux",
"code": "theorem Poly.denote_reverseAux (ctx : Context) (p q : Poly) : denote ctx (List.reverseAux p q) = denote ctx (p ++ q)",
"start": [
307,
1
],
"end": [
310,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_reverse",
"code": "theorem Poly.denote_reverse (ctx : Context) (p : Poly) : denote ctx (List.reverse p) = denote ctx p",
"start": [
314,
1
],
"end": [
315,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_fuse",
"code": "theorem Poly.denote_fuse (ctx : Context) (p : Poly) : p.fuse.denote ctx = p.denote ctx",
"start": [
319,
1
],
"end": [
327,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_mul",
"code": "theorem Poly.denote_mul (ctx : Context) (k : Nat) (p : Poly) : (p.mul k).denote ctx = k * p.denote ctx",
"start": [
331,
1
],
"end": [
337,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.eq_of_not_blt_eq_true",
"code": "private theorem eq_of_not_blt_eq_true (h₁ : ¬ (Nat.blt x y = true)) (h₂ : ¬ (Nat.blt y x = true)) : x = y",
"start": [
339,
1
],
"end": [
342,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_eq_cancelAux",
"code": "theorem Poly.denote_eq_cancelAux (ctx : Context) (fuel : Nat) (m₁ m₂ r₁ r₂ : Poly)\n (h : denote_eq ctx (r₁.reverse ++ m₁, r₂.reverse ++ m₂)) : denote_eq ctx (cancelAux fuel m₁ m₂ r₁ r₂)",
"start": [
346,
1
],
"end": [
378,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_denote_eq_cancelAux",
"code": "theorem Poly.of_denote_eq_cancelAux (ctx : Context) (fuel : Nat) (m₁ m₂ r₁ r₂ : Poly)\n (h : denote_eq ctx (cancelAux fuel m₁ m₂ r₁ r₂)) : denote_eq ctx (r₁.reverse ++ m₁, r₂.reverse ++ m₂)",
"start": [
380,
1
],
"end": [
409,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_eq_cancel",
"code": "theorem Poly.denote_eq_cancel {ctx : Context} {m₁ m₂ : Poly} (h : denote_eq ctx (m₁, m₂)) : denote_eq ctx (cancel m₁ m₂)",
"start": [
411,
1
],
"end": [
412,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_denote_eq_cancel",
"code": "theorem Poly.of_denote_eq_cancel {ctx : Context} {m₁ m₂ : Poly} (h : denote_eq ctx (cancel m₁ m₂)) : denote_eq ctx (m₁, m₂)",
"start": [
414,
1
],
"end": [
417,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_eq_cancel_eq",
"code": "theorem Poly.denote_eq_cancel_eq (ctx : Context) (m₁ m₂ : Poly) : denote_eq ctx (cancel m₁ m₂) = denote_eq ctx (m₁, m₂)",
"start": [
419,
1
],
"end": [
420,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_le_cancelAux",
"code": "theorem Poly.denote_le_cancelAux (ctx : Context) (fuel : Nat) (m₁ m₂ r₁ r₂ : Poly)\n (h : denote_le ctx (r₁.reverse ++ m₁, r₂.reverse ++ m₂)) : denote_le ctx (cancelAux fuel m₁ m₂ r₁ r₂)",
"start": [
424,
1
],
"end": [
456,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_denote_le_cancelAux",
"code": "theorem Poly.of_denote_le_cancelAux (ctx : Context) (fuel : Nat) (m₁ m₂ r₁ r₂ : Poly)\n (h : denote_le ctx (cancelAux fuel m₁ m₂ r₁ r₂)) : denote_le ctx (r₁.reverse ++ m₁, r₂.reverse ++ m₂)",
"start": [
458,
1
],
"end": [
489,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_le_cancel",
"code": "theorem Poly.denote_le_cancel {ctx : Context} {m₁ m₂ : Poly} (h : denote_le ctx (m₁, m₂)) : denote_le ctx (cancel m₁ m₂)",
"start": [
491,
1
],
"end": [
492,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_denote_le_cancel",
"code": "theorem Poly.of_denote_le_cancel {ctx : Context} {m₁ m₂ : Poly} (h : denote_le ctx (cancel m₁ m₂)) : denote_le ctx (m₁, m₂)",
"start": [
494,
1
],
"end": [
497,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_le_cancel_eq",
"code": "theorem Poly.denote_le_cancel_eq (ctx : Context) (m₁ m₂ : Poly) : denote_le ctx (cancel m₁ m₂) = denote_le ctx (m₁, m₂)",
"start": [
499,
1
],
"end": [
500,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_combineAux",
"code": "theorem Poly.denote_combineAux (ctx : Context) (fuel : Nat) (p₁ p₂ : Poly) : (p₁.combineAux fuel p₂).denote ctx = p₁.denote ctx + p₂.denote ctx",
"start": [
504,
1
],
"end": [
512,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_combine",
"code": "theorem Poly.denote_combine (ctx : Context) (p₁ p₂ : Poly) : (p₁.combine p₂).denote ctx = p₁.denote ctx + p₂.denote ctx",
"start": [
514,
1
],
"end": [
515,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.denote_toPoly",
"code": "theorem Expr.denote_toPoly (ctx : Context) (e : Expr) : e.toPoly.denote ctx = e.denote ctx",
"start": [
519,
1
],
"end": [
525,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.eq_of_toNormPoly",
"code": "theorem Expr.eq_of_toNormPoly (ctx : Context) (a b : Expr) (h : a.toNormPoly = b.toNormPoly) : a.denote ctx = b.denote ctx",
"start": [
529,
1
],
"end": [
533,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.of_cancel_eq",
"code": "theorem Expr.of_cancel_eq (ctx : Context) (a b c d : Expr) (h : Poly.cancel a.toNormPoly b.toNormPoly = (c.toPoly, d.toPoly)) : (a.denote ctx = b.denote ctx) = (c.denote ctx = d.denote ctx)",
"start": [
535,
1
],
"end": [
539,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.of_cancel_le",
"code": "theorem Expr.of_cancel_le (ctx : Context) (a b c d : Expr) (h : Poly.cancel a.toNormPoly b.toNormPoly = (c.toPoly, d.toPoly)) : (a.denote ctx ≤ b.denote ctx) = (c.denote ctx ≤ d.denote ctx)",
"start": [
541,
1
],
"end": [
545,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.of_cancel_lt",
"code": "theorem Expr.of_cancel_lt (ctx : Context) (a b c d : Expr) (h : Poly.cancel a.inc.toNormPoly b.toNormPoly = (c.inc.toPoly, d.toPoly)) : (a.denote ctx < b.denote ctx) = (c.denote ctx < d.denote ctx)",
"start": [
547,
1
],
"end": [
548,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.toPoly_norm_eq",
"code": "theorem ExprCnstr.toPoly_norm_eq (c : ExprCnstr) : c.toPoly.norm = c.toNormPoly",
"start": [
550,
1
],
"end": [
551,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.denote_toPoly",
"code": "theorem ExprCnstr.denote_toPoly (ctx : Context) (c : ExprCnstr) : c.toPoly.denote ctx = c.denote ctx",
"start": [
553,
1
],
"end": [
558,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.denote_toNormPoly",
"code": "theorem ExprCnstr.denote_toNormPoly (ctx : Context) (c : ExprCnstr) : c.toNormPoly.denote ctx = c.denote ctx",
"start": [
562,
1
],
"end": [
567,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.mul.go_denote",
"code": "theorem Poly.mul.go_denote (ctx : Context) (k : Nat) (p : Poly) : (Poly.mul.go k p).denote ctx = k * p.denote ctx",
"start": [
571,
1
],
"end": [
574,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.denote_mul",
"code": "theorem PolyCnstr.denote_mul (ctx : Context) (k : Nat) (c : PolyCnstr) : (c.mul (k+1)).denote ctx = c.denote ctx",
"start": [
581,
1
],
"end": [
591,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.denote_combine",
"code": "theorem PolyCnstr.denote_combine {ctx : Context} {c₁ c₂ : PolyCnstr} (h₁ : c₁.denote ctx) (h₂ : c₂.denote ctx) : (c₁.combine c₂).denote ctx",
"start": [
597,
1
],
"end": [
605,
113
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.isNum?_eq_some",
"code": "theorem Poly.isNum?_eq_some (ctx : Context) {p : Poly} {k : Nat} : p.isNum? = some k → p.denote ctx = k",
"start": [
609,
1
],
"end": [
614,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_isZero",
"code": "theorem Poly.of_isZero (ctx : Context) {p : Poly} (h : isZero p = true) : p.denote ctx = 0",
"start": [
616,
1
],
"end": [
620,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.of_isNonZero",
"code": "theorem Poly.of_isNonZero (ctx : Context) {p : Poly} (h : isNonZero p = true) : p.denote ctx > 0",
"start": [
622,
1
],
"end": [
629,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.eq_false_of_isUnsat",
"code": "theorem PolyCnstr.eq_false_of_isUnsat (ctx : Context) {c : PolyCnstr} : c.isUnsat → c.denote ctx = False",
"start": [
631,
1
],
"end": [
640,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.PolyCnstr.eq_true_of_isValid",
"code": "theorem PolyCnstr.eq_true_of_isValid (ctx : Context) {c : PolyCnstr} : c.isValid → c.denote ctx = True",
"start": [
642,
1
],
"end": [
649,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.eq_false_of_isUnsat",
"code": "theorem ExprCnstr.eq_false_of_isUnsat (ctx : Context) (c : ExprCnstr) (h : c.toNormPoly.isUnsat) : c.denote ctx = False",
"start": [
651,
1
],
"end": [
654,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.eq_true_of_isValid",
"code": "theorem ExprCnstr.eq_true_of_isValid (ctx : Context) (c : ExprCnstr) (h : c.toNormPoly.isValid) : c.denote ctx = True",
"start": [
656,
1
],
"end": [
659,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.of_combineHyps",
"code": "theorem Certificate.of_combineHyps (ctx : Context) (c : PolyCnstr) (cs : Certificate) (h : (combineHyps c cs).denote ctx → False) : c.denote ctx → cs.denote ctx",
"start": [
661,
1
],
"end": [
670,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.of_combine",
"code": "theorem Certificate.of_combine (ctx : Context) (cs : Certificate) (h : cs.combine.denote ctx → False) : cs.denote ctx",
"start": [
672,
1
],
"end": [
679,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Certificate.of_combine_isUnsat",
"code": "theorem Certificate.of_combine_isUnsat (ctx : Context) (cs : Certificate) (h : cs.combine.isUnsat) : cs.denote ctx",
"start": [
681,
1
],
"end": [
683,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.denote_monomialToExpr",
"code": "theorem denote_monomialToExpr (ctx : Context) (k : Nat) (v : Var) : (monomialToExpr k v).denote ctx = k * v.denote ctx",
"start": [
685,
1
],
"end": [
689,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_toExpr_go",
"code": "theorem Poly.denote_toExpr_go (ctx : Context) (e : Expr) (p : Poly) : (toExpr.go e p).denote ctx = e.denote ctx + p.denote ctx",
"start": [
693,
1
],
"end": [
696,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Poly.denote_toExpr",
"code": "theorem Poly.denote_toExpr (ctx : Context) (p : Poly) : p.toExpr.denote ctx = p.denote ctx",
"start": [
700,
1
],
"end": [
703,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.ExprCnstr.eq_of_toNormPoly_eq",
"code": "theorem ExprCnstr.eq_of_toNormPoly_eq (ctx : Context) (c d : ExprCnstr) (h : c.toNormPoly == d.toPoly) : c.denote ctx = d.denote ctx",
"start": [
705,
1
],
"end": [
708,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.Linear.Expr.eq_of_toNormPoly_eq",
"code": "theorem Expr.eq_of_toNormPoly_eq (ctx : Context) (e e' : Expr) (h : e.toNormPoly == e'.toPoly) : e.denote ctx = e'.denote ctx",
"start": [
710,
1
],
"end": [
713,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "elimOffset",
"code": "def elimOffset {α : Sort u} (a b k : Nat) (h₁ : a + k = b + k) (h₂ : a = b → α) : α := by\n simp_arith at h₁\n exact h₂ h₁",
"start": [
717,
1
],
"end": [
719,
14
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Option/Instances.lean | [
".lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean"
] | [
{
"full_name": "Option.eq_of_eq_some",
"code": "theorem eq_of_eq_some {α : Type u} : ∀ {x y : Option α}, (∀z, x = some z ↔ y = some z) → x = y",
"start": [
13,
1
],
"end": [
17,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.eq_none_of_isNone",
"code": "theorem eq_none_of_isNone {α : Type u} : ∀ {o : Option α}, o.isNone → o = none",
"start": [
19,
1
],
"end": [
20,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mem_def",
"code": "@[simp] theorem mem_def {a : α} {b : Option α} : a ∈ b ↔ b = some a",
"start": [
24,
1
],
"end": [
24,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isNone_iff_eq_none",
"code": "@[simp] theorem isNone_iff_eq_none {o : Option α} : o.isNone ↔ o = none",
"start": [
29,
1
],
"end": [
30,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.some_inj",
"code": "theorem some_inj {a b : α} : some a = some b ↔ a = b",
"start": [
32,
1
],
"end": [
32,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.decidable_eq_none",
"code": "@[inline] def decidable_eq_none {o : Option α} : Decidable (o = none) :=\n decidable_of_decidable_of_iff isNone_iff_eq_none",
"start": [
34,
1
],
"end": [
40,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.pbind",
"code": "@[simp, inline]\ndef pbind : ∀ x : Option α, (∀ a : α, a ∈ x → Option β) → Option β\n | none, _ => none\n | some a, f => f a rfl",
"start": [
52,
1
],
"end": [
61,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.pmap",
"code": "@[simp, inline] def pmap {p : α → Prop} (f : ∀ a : α, p a → β) :\n ∀ x : Option α, (∀ a, a ∈ x → p a) → Option β\n | none, _ => none\n | some a, H => f a (H a rfl)",
"start": [
63,
1
],
"end": [
71,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.forM",
"code": "@[inline] protected def forM [Pure m] : Option α → (α → m PUnit) → m PUnit\n | none , _ => pure ⟨⟩\n | some a, f => f a",
"start": [
73,
1
],
"end": [
76,
21
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Ext.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Macro.lean",
".lake/packages/lean4/src/lean/Init/RCases.lean",
".lake/packages/lean4/src/lean/Init/TacticsExtra.lean"
] | [
{
"full_name": "Lean.Elab.Tactic.Ext.$extName",
"code": "@[ext $(prio)?] protected theorem $extName:ident : ext_type% $flat $struct:ident",
"start": [
59,
5
],
"end": [
60,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Elab.Tactic.Ext.$extIffName",
"code": "protected theorem $extIffName:ident : ext_iff_type% $flat $struct:ident",
"start": [
61,
5
],
"end": [
64,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Prod.ext",
"code": "@[ext] theorem Prod.ext : {x y : Prod α β} → x.fst = y.fst → x.snd = y.snd → x = y",
"start": [
101,
1
],
"end": [
102,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "PProd.ext",
"code": "@[ext] theorem PProd.ext : {x y : PProd α β} → x.fst = y.fst → x.snd = y.snd → x = y",
"start": [
104,
1
],
"end": [
105,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Sigma.ext",
"code": "@[ext] theorem Sigma.ext : {x y : Sigma β} → x.fst = y.fst → HEq x.snd y.snd → x = y",
"start": [
107,
1
],
"end": [
108,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "PSigma.ext",
"code": "@[ext] theorem PSigma.ext : {x y : PSigma β} → x.fst = y.fst → HEq x.snd y.snd → x = y",
"start": [
110,
1
],
"end": [
111,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "PUnit.ext",
"code": "@[ext] protected theorem PUnit.ext (x y : PUnit) : x = y",
"start": [
113,
1
],
"end": [
113,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Unit.ext",
"code": "protected theorem Unit.ext (x y : Unit) : x = y",
"start": [
114,
1
],
"end": [
114,
55
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Dvd.lean | [
".lake/packages/lean4/src/lean/Init/Meta.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Div.lean"
] | [
{
"full_name": "Nat.dvd_refl",
"code": "protected theorem dvd_refl (a : Nat) : a ∣ a",
"start": [
12,
1
],
"end": [
12,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_zero",
"code": "protected theorem dvd_zero (a : Nat) : a ∣ 0",
"start": [
14,
1
],
"end": [
14,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_mul_left",
"code": "protected theorem dvd_mul_left (a b : Nat) : a ∣ b * a",
"start": [
16,
1
],
"end": [
16,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_mul_right",
"code": "protected theorem dvd_mul_right (a b : Nat) : a ∣ a * b",
"start": [
17,
1
],
"end": [
17,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_trans",
"code": "protected theorem dvd_trans {a b c : Nat} (h₁ : a ∣ b) (h₂ : b ∣ c) : a ∣ c",
"start": [
19,
1
],
"end": [
22,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_zero_dvd",
"code": "protected theorem eq_zero_of_zero_dvd {a : Nat} (h : 0 ∣ a) : a = 0",
"start": [
24,
1
],
"end": [
25,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_dvd",
"code": "@[simp] protected theorem zero_dvd {n : Nat} : 0 ∣ n ↔ n = 0",
"start": [
27,
1
],
"end": [
28,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_add",
"code": "protected theorem dvd_add {a b c : Nat} (h₁ : a ∣ b) (h₂ : a ∣ c) : a ∣ b + c",
"start": [
30,
1
],
"end": [
31,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_add_iff_right",
"code": "protected theorem dvd_add_iff_right {k m n : Nat} (h : k ∣ m) : k ∣ n ↔ k ∣ m + n",
"start": [
33,
1
],
"end": [
37,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_add_iff_left",
"code": "protected theorem dvd_add_iff_left {k m n : Nat} (h : k ∣ n) : k ∣ m ↔ k ∣ m + n",
"start": [
39,
1
],
"end": [
40,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_mod_iff",
"code": "theorem dvd_mod_iff {k m n : Nat} (h: k ∣ n) : k ∣ m % n ↔ k ∣ m",
"start": [
42,
1
],
"end": [
44,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_dvd",
"code": "theorem le_of_dvd {m n : Nat} (h : 0 < n) : m ∣ n → m ≤ n",
"start": [
46,
1
],
"end": [
55,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_antisymm",
"code": "protected theorem dvd_antisymm : ∀ {m n : Nat}, m ∣ n → n ∣ m → m = n",
"start": [
57,
1
],
"end": [
60,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_dvd_of_pos",
"code": "theorem pos_of_dvd_of_pos {m n : Nat} (H1 : m ∣ n) (H2 : 0 < n) : 0 < m",
"start": [
62,
1
],
"end": [
63,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_dvd",
"code": "@[simp] protected theorem one_dvd (n : Nat) : 1 ∣ n",
"start": [
65,
1
],
"end": [
65,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_one_of_dvd_one",
"code": "theorem eq_one_of_dvd_one {n : Nat} (H : n ∣ 1) : n = 1",
"start": [
67,
1
],
"end": [
67,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_eq_zero_of_dvd",
"code": "theorem mod_eq_zero_of_dvd {m n : Nat} (H : m ∣ n) : n % m = 0",
"start": [
69,
1
],
"end": [
70,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_of_mod_eq_zero",
"code": "theorem dvd_of_mod_eq_zero {m n : Nat} (H : n % m = 0) : m ∣ n",
"start": [
72,
1
],
"end": [
75,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_iff_mod_eq_zero",
"code": "theorem dvd_iff_mod_eq_zero (m n : Nat) : m ∣ n ↔ n % m = 0",
"start": [
77,
1
],
"end": [
78,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidable_dvd",
"code": "instance decidable_dvd : @DecidableRel Nat (·∣·) :=\n fun _ _ => decidable_of_decidable_of_iff (dvd_iff_mod_eq_zero _ _).symm",
"start": [
80,
1
],
"end": [
81,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.emod_pos_of_not_dvd",
"code": "theorem emod_pos_of_not_dvd {a b : Nat} (h : ¬ a ∣ b) : 0 < b % a",
"start": [
83,
1
],
"end": [
85,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_cancel'",
"code": "protected theorem mul_div_cancel' {n m : Nat} (H : n ∣ m) : n * (m / n) = m",
"start": [
87,
1
],
"end": [
89,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_mul_cancel",
"code": "protected theorem div_mul_cancel {n m : Nat} (H : n ∣ m) : m / n * n = m",
"start": [
91,
1
],
"end": [
92,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_mod_of_dvd",
"code": "@[simp] theorem mod_mod_of_dvd (a : Nat) (h : c ∣ b) : a % b % c = a % c",
"start": [
94,
1
],
"end": [
98,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_of_mul_dvd_mul_left",
"code": "protected theorem dvd_of_mul_dvd_mul_left\n (kpos : 0 < k) (H : k * m ∣ k * n) : m ∣ n",
"start": [
100,
1
],
"end": [
104,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_of_mul_dvd_mul_right",
"code": "protected theorem dvd_of_mul_dvd_mul_right (kpos : 0 < k) (H : m * k ∣ n * k) : m ∣ n",
"start": [
106,
1
],
"end": [
107,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_sub",
"code": "theorem dvd_sub {k m n : Nat} (H : n ≤ m) (h₁ : k ∣ m) (h₂ : k ∣ n) : k ∣ m - n",
"start": [
109,
1
],
"end": [
110,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_dvd_mul",
"code": "protected theorem mul_dvd_mul {a b c d : Nat} : a ∣ b → c ∣ d → a * c ∣ b * d",
"start": [
112,
1
],
"end": [
114,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_dvd_mul_left",
"code": "protected theorem mul_dvd_mul_left (a : Nat) (h : b ∣ c) : a * b ∣ a * c",
"start": [
116,
1
],
"end": [
117,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_dvd_mul_right",
"code": "protected theorem mul_dvd_mul_right (h: a ∣ b) (c : Nat) : a * c ∣ b * c",
"start": [
119,
1
],
"end": [
120,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_one",
"code": "@[simp] theorem dvd_one {n : Nat} : n ∣ 1 ↔ n = 1",
"start": [
122,
1
],
"end": [
123,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_div_assoc",
"code": "protected theorem mul_div_assoc (m : Nat) (H : k ∣ n) : m * n / k = m * (n / k)",
"start": [
125,
1
],
"end": [
130,
56
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Int/Order.lean | [
".lake/packages/lean4/src/lean/Init/Data/Int/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/ByCases.lean"
] | [
{
"full_name": "Int.nonneg_def",
"code": "theorem nonneg_def {a : Int} : NonNeg a ↔ ∃ n : Nat, a = n",
"start": [
20,
1
],
"end": [
21,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.NonNeg.elim",
"code": "theorem NonNeg.elim {a : Int} : NonNeg a → ∃ n : Nat, a = n",
"start": [
23,
1
],
"end": [
23,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.nonneg_or_nonneg_neg",
"code": "theorem nonneg_or_nonneg_neg : ∀ (a : Int), NonNeg a ∨ NonNeg (-a)",
"start": [
25,
1
],
"end": [
27,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_def",
"code": "theorem le_def (a b : Int) : a ≤ b ↔ NonNeg (b - a)",
"start": [
29,
1
],
"end": [
29,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_iff_add_one_le",
"code": "theorem lt_iff_add_one_le (a b : Int) : a < b ↔ a + 1 ≤ b",
"start": [
31,
1
],
"end": [
31,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le.intro_sub",
"code": "theorem le.intro_sub {a b : Int} (n : Nat) (h : b - a = n) : a ≤ b",
"start": [
33,
1
],
"end": [
34,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le.intro",
"code": "theorem le.intro {a b : Int} (n : Nat) (h : a + n = b) : a ≤ b",
"start": [
38,
1
],
"end": [
39,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le.dest_sub",
"code": "theorem le.dest_sub {a b : Int} (h : a ≤ b) : ∃ n : Nat, b - a = n",
"start": [
41,
1
],
"end": [
41,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le.dest",
"code": "theorem le.dest {a b : Int} (h : a ≤ b) : ∃ n : Nat, a + n = b",
"start": [
43,
1
],
"end": [
45,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_total",
"code": "protected theorem le_total (a b : Int) : a ≤ b ∨ b ≤ a",
"start": [
47,
1
],
"end": [
49,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_le",
"code": "@[simp, norm_cast] theorem ofNat_le {m n : Nat} : (↑m : Int) ≤ ↑n ↔ m ≤ n",
"start": [
51,
1
],
"end": [
57,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_zero_le",
"code": "theorem ofNat_zero_le (n : Nat) : 0 ≤ (↑n : Int)",
"start": [
59,
1
],
"end": [
59,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_ofNat_of_zero_le",
"code": "theorem eq_ofNat_of_zero_le {a : Int} (h : 0 ≤ a) : ∃ n : Nat, a = n",
"start": [
61,
1
],
"end": [
62,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_succ_of_zero_lt",
"code": "theorem eq_succ_of_zero_lt {a : Int} (h : 0 < a) : ∃ n : Nat, a = n.succ",
"start": [
64,
1
],
"end": [
66,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_succ",
"code": "theorem lt_add_succ (a : Int) (n : Nat) : a < a + Nat.succ n",
"start": [
68,
1
],
"end": [
69,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt.intro",
"code": "theorem lt.intro {a b : Int} {n : Nat} (h : a + Nat.succ n = b) : a < b",
"start": [
71,
1
],
"end": [
72,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt.dest",
"code": "theorem lt.dest {a b : Int} (h : a < b) : ∃ n : Nat, a + Nat.succ n = b",
"start": [
74,
1
],
"end": [
75,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_lt",
"code": "@[simp, norm_cast] theorem ofNat_lt {n m : Nat} : (↑n : Int) < ↑m ↔ n < m",
"start": [
77,
1
],
"end": [
78,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_pos",
"code": "@[simp, norm_cast] theorem ofNat_pos {n : Nat} : 0 < (↑n : Int) ↔ 0 < n",
"start": [
80,
1
],
"end": [
80,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_nonneg",
"code": "theorem ofNat_nonneg (n : Nat) : 0 ≤ (n : Int)",
"start": [
82,
1
],
"end": [
82,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_succ_pos",
"code": "theorem ofNat_succ_pos (n : Nat) : 0 < (succ n : Int)",
"start": [
84,
1
],
"end": [
84,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_refl",
"code": "@[simp] protected theorem le_refl (a : Int) : a ≤ a",
"start": [
86,
1
],
"end": [
87,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_trans",
"code": "protected theorem le_trans {a b c : Int} (h₁ : a ≤ b) (h₂ : b ≤ c) : a ≤ c",
"start": [
89,
1
],
"end": [
91,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_antisymm",
"code": "protected theorem le_antisymm {a b : Int} (h₁ : a ≤ b) (h₂ : b ≤ a) : a = b",
"start": [
93,
1
],
"end": [
97,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl (a : Int) : ¬a < a",
"start": [
99,
1
],
"end": [
104,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ne_of_lt",
"code": "protected theorem ne_of_lt {a b : Int} (h : a < b) : a ≠ b",
"start": [
106,
1
],
"end": [
107,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ne_of_gt",
"code": "protected theorem ne_of_gt {a b : Int} (h : b < a) : a ≠ b",
"start": [
109,
1
],
"end": [
109,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_lt",
"code": "protected theorem le_of_lt {a b : Int} (h : a < b) : a ≤ b",
"start": [
111,
1
],
"end": [
112,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_iff_le_and_ne",
"code": "protected theorem lt_iff_le_and_ne {a b : Int} : a < b ↔ a ≤ b ∧ a ≠ b",
"start": [
114,
1
],
"end": [
118,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_succ",
"code": "theorem lt_succ (a : Int) : a < a + 1",
"start": [
120,
1
],
"end": [
120,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_lt_one",
"code": "protected theorem zero_lt_one : (0 : Int) < 1",
"start": [
122,
1
],
"end": [
122,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_iff_le_not_le",
"code": "protected theorem lt_iff_le_not_le {a b : Int} : a < b ↔ a ≤ b ∧ ¬b ≤ a",
"start": [
124,
1
],
"end": [
128,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_not_ge",
"code": "protected theorem lt_of_not_ge {a b : Int} (h : ¬a ≤ b) : b < a",
"start": [
130,
1
],
"end": [
131,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.not_le_of_gt",
"code": "protected theorem not_le_of_gt {a b : Int} (h : b < a) : ¬a ≤ b",
"start": [
133,
1
],
"end": [
134,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.not_le",
"code": "protected theorem not_le {a b : Int} : ¬a ≤ b ↔ b < a",
"start": [
136,
1
],
"end": [
137,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.not_lt",
"code": "protected theorem not_lt {a b : Int} : ¬a < b ↔ b ≤ a",
"start": [
139,
1
],
"end": [
140,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_trichotomy",
"code": "protected theorem lt_trichotomy (a b : Int) : a < b ∨ a = b ∨ b < a",
"start": [
142,
1
],
"end": [
145,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ne_iff_lt_or_gt",
"code": "protected theorem ne_iff_lt_or_gt {a b : Int} : a ≠ b ↔ a < b ∨ b < a",
"start": [
147,
1
],
"end": [
159,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_or_gt_of_ne",
"code": "protected theorem lt_or_gt_of_ne {a b : Int} : a ≠ b → a < b ∨ b < a",
"start": [
161,
1
],
"end": [
161,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_iff_le_and_ge",
"code": "protected theorem eq_iff_le_and_ge {x y : Int} : x = y ↔ x ≤ y ∧ y ≤ x",
"start": [
163,
1
],
"end": [
167,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_le_of_lt",
"code": "protected theorem lt_of_le_of_lt {a b c : Int} (h₁ : a ≤ b) (h₂ : b < c) : a < c",
"start": [
169,
1
],
"end": [
170,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_lt_of_le",
"code": "protected theorem lt_of_lt_of_le {a b c : Int} (h₁ : a < b) (h₂ : b ≤ c) : a < c",
"start": [
172,
1
],
"end": [
173,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_trans",
"code": "protected theorem lt_trans {a b c : Int} (h₁ : a < b) (h₂ : b < c) : a < c",
"start": [
175,
1
],
"end": [
176,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_def",
"code": "protected theorem min_def (n m : Int) : min n m = if n ≤ m then n else m",
"start": [
186,
1
],
"end": [
186,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.max_def",
"code": "protected theorem max_def (n m : Int) : max n m = if n ≤ m then m else n",
"start": [
188,
1
],
"end": [
188,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_comm",
"code": "protected theorem min_comm (a b : Int) : min a b = min b a",
"start": [
190,
1
],
"end": [
194,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_le_right",
"code": "protected theorem min_le_right (a b : Int) : min a b ≤ b",
"start": [
197,
1
],
"end": [
197,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_le_left",
"code": "protected theorem min_le_left (a b : Int) : min a b ≤ a",
"start": [
199,
1
],
"end": [
199,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_eq_left",
"code": "protected theorem min_eq_left {a b : Int} (h : a ≤ b) : min a b = a",
"start": [
201,
1
],
"end": [
201,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.min_eq_right",
"code": "protected theorem min_eq_right {a b : Int} (h : b ≤ a) : min a b = b",
"start": [
203,
1
],
"end": [
204,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_min",
"code": "protected theorem le_min {a b c : Int} : a ≤ min b c ↔ a ≤ b ∧ a ≤ c",
"start": [
206,
1
],
"end": [
208,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.max_comm",
"code": "protected theorem max_comm (a b : Int) : max a b = max b a",
"start": [
210,
1
],
"end": [
214,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_max_left",
"code": "protected theorem le_max_left (a b : Int) : a ≤ max a b",
"start": [
217,
1
],
"end": [
217,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_max_right",
"code": "protected theorem le_max_right (a b : Int) : b ≤ max a b",
"start": [
219,
1
],
"end": [
219,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.max_le",
"code": "protected theorem max_le {a b c : Int} : max a b ≤ c ↔ a ≤ c ∧ b ≤ c",
"start": [
221,
1
],
"end": [
223,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.max_eq_right",
"code": "protected theorem max_eq_right {a b : Int} (h : a ≤ b) : max a b = b",
"start": [
225,
1
],
"end": [
226,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.max_eq_left",
"code": "protected theorem max_eq_left {a b : Int} (h : b ≤ a) : max a b = a",
"start": [
228,
1
],
"end": [
229,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_natAbs_of_zero_le",
"code": "theorem eq_natAbs_of_zero_le {a : Int} (h : 0 ≤ a) : a = natAbs a",
"start": [
231,
1
],
"end": [
233,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_natAbs",
"code": "theorem le_natAbs {a : Int} : a ≤ natAbs a",
"start": [
235,
1
],
"end": [
238,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_lt_zero",
"code": "theorem negSucc_lt_zero (n : Nat) : -[n+1] < 0",
"start": [
240,
1
],
"end": [
241,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_not_nonneg",
"code": "@[simp] theorem negSucc_not_nonneg (n : Nat) : 0 ≤ -[n+1] ↔ False",
"start": [
243,
1
],
"end": [
244,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add_left",
"code": "protected theorem add_le_add_left {a b : Int} (h : a ≤ b) (c : Int) : c + a ≤ c + b",
"start": [
246,
1
],
"end": [
247,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_left",
"code": "protected theorem add_lt_add_left {a b : Int} (h : a < b) (c : Int) : c + a < c + b",
"start": [
249,
1
],
"end": [
251,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add_right",
"code": "protected theorem add_le_add_right {a b : Int} (h : a ≤ b) (c : Int) : a + c ≤ b + c",
"start": [
253,
1
],
"end": [
254,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_right",
"code": "protected theorem add_lt_add_right {a b : Int} (h : a < b) (c : Int) : a + c < b + c",
"start": [
256,
1
],
"end": [
257,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_add_le_add_left",
"code": "protected theorem le_of_add_le_add_left {a b c : Int} (h : a + b ≤ a + c) : b ≤ c",
"start": [
259,
1
],
"end": [
262,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_add_le_add_right",
"code": "protected theorem le_of_add_le_add_right {a b c : Int} (h : a + b ≤ c + b) : a ≤ c",
"start": [
264,
1
],
"end": [
265,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add_iff_left",
"code": "protected theorem add_le_add_iff_left (a : Int) : a + b ≤ a + c ↔ b ≤ c",
"start": [
267,
1
],
"end": [
268,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add_iff_right",
"code": "protected theorem add_le_add_iff_right (c : Int) : a + c ≤ b + c ↔ a ≤ b",
"start": [
270,
1
],
"end": [
271,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add",
"code": "protected theorem add_le_add {a b c d : Int} (h₁ : a ≤ b) (h₂ : c ≤ d) : a + c ≤ b + d",
"start": [
273,
1
],
"end": [
274,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_nonneg_right",
"code": "protected theorem le_add_of_nonneg_right {a b : Int} (h : 0 ≤ b) : a ≤ a + b",
"start": [
276,
1
],
"end": [
278,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_nonneg_left",
"code": "protected theorem le_add_of_nonneg_left {a b : Int} (h : 0 ≤ b) : a ≤ b + a",
"start": [
280,
1
],
"end": [
282,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_le_neg",
"code": "protected theorem neg_le_neg {a b : Int} (h : a ≤ b) : -b ≤ -a",
"start": [
284,
1
],
"end": [
287,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_neg_le_neg",
"code": "protected theorem le_of_neg_le_neg {a b : Int} (h : -b ≤ -a) : a ≤ b",
"start": [
289,
1
],
"end": [
291,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_nonpos_of_nonneg",
"code": "protected theorem neg_nonpos_of_nonneg {a : Int} (h : 0 ≤ a) : -a ≤ 0",
"start": [
293,
1
],
"end": [
295,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_nonneg_of_nonpos",
"code": "protected theorem neg_nonneg_of_nonpos {a : Int} (h : a ≤ 0) : 0 ≤ -a",
"start": [
297,
1
],
"end": [
299,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_lt_neg",
"code": "protected theorem neg_lt_neg {a b : Int} (h : a < b) : -b < -a",
"start": [
301,
1
],
"end": [
304,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_neg_of_pos",
"code": "protected theorem neg_neg_of_pos {a : Int} (h : 0 < a) : -a < 0",
"start": [
306,
1
],
"end": [
308,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_pos_of_neg",
"code": "protected theorem neg_pos_of_neg {a : Int} (h : a < 0) : 0 < -a",
"start": [
310,
1
],
"end": [
312,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_nonneg_of_le",
"code": "protected theorem sub_nonneg_of_le {a b : Int} (h : b ≤ a) : 0 ≤ a - b",
"start": [
314,
1
],
"end": [
316,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_sub_nonneg",
"code": "protected theorem le_of_sub_nonneg {a b : Int} (h : 0 ≤ a - b) : b ≤ a",
"start": [
318,
1
],
"end": [
320,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_pos_of_lt",
"code": "protected theorem sub_pos_of_lt {a b : Int} (h : b < a) : 0 < a - b",
"start": [
322,
1
],
"end": [
324,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_sub_pos",
"code": "protected theorem lt_of_sub_pos {a b : Int} (h : 0 < a - b) : b < a",
"start": [
326,
1
],
"end": [
328,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_left_le_of_le_add",
"code": "protected theorem sub_left_le_of_le_add {a b c : Int} (h : a ≤ b + c) : a - b ≤ c",
"start": [
330,
1
],
"end": [
332,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_le_self",
"code": "protected theorem sub_le_self (a : Int) {b : Int} (h : 0 ≤ b) : a - b ≤ a",
"start": [
334,
1
],
"end": [
337,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_self",
"code": "protected theorem sub_lt_self (a : Int) {b : Int} (h : 0 < b) : a - b < a",
"start": [
339,
1
],
"end": [
342,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_one_le_of_lt",
"code": "theorem add_one_le_of_lt {a b : Int} (H : a < b) : a + 1 ≤ b",
"start": [
344,
1
],
"end": [
344,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_nonneg",
"code": "protected theorem mul_nonneg {a b : Int} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a * b",
"start": [
349,
1
],
"end": [
352,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_pos",
"code": "protected theorem mul_pos {a b : Int} (ha : 0 < a) (hb : 0 < b) : 0 < a * b",
"start": [
354,
1
],
"end": [
357,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul_of_pos_left",
"code": "protected theorem mul_lt_mul_of_pos_left {a b c : Int}\n (h₁ : a < b) (h₂ : 0 < c) : c * a < c * b",
"start": [
359,
1
],
"end": [
363,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul_of_pos_right",
"code": "protected theorem mul_lt_mul_of_pos_right {a b c : Int}\n (h₁ : a < b) (h₂ : 0 < c) : a * c < b * c",
"start": [
365,
1
],
"end": [
370,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_mul_of_nonneg_left",
"code": "protected theorem mul_le_mul_of_nonneg_left {a b c : Int}\n (h₁ : a ≤ b) (h₂ : 0 ≤ c) : c * a ≤ c * b",
"start": [
372,
1
],
"end": [
380,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_mul_of_nonneg_right",
"code": "protected theorem mul_le_mul_of_nonneg_right {a b c : Int}\n (h₁ : a ≤ b) (h₂ : 0 ≤ c) : a * c ≤ b * c",
"start": [
382,
1
],
"end": [
384,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_mul",
"code": "protected theorem mul_le_mul {a b c d : Int}\n (hac : a ≤ c) (hbd : b ≤ d) (nn_b : 0 ≤ b) (nn_c : 0 ≤ c) : a * b ≤ c * d",
"start": [
386,
1
],
"end": [
388,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_nonpos_of_nonneg_of_nonpos",
"code": "protected theorem mul_nonpos_of_nonneg_of_nonpos {a b : Int}\n (ha : 0 ≤ a) (hb : b ≤ 0) : a * b ≤ 0",
"start": [
390,
1
],
"end": [
393,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_nonpos_of_nonpos_of_nonneg",
"code": "protected theorem mul_nonpos_of_nonpos_of_nonneg {a b : Int}\n (ha : a ≤ 0) (hb : 0 ≤ b) : a * b ≤ 0",
"start": [
395,
1
],
"end": [
398,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_mul_of_nonpos_right",
"code": "protected theorem mul_le_mul_of_nonpos_right {a b c : Int}\n (h : b ≤ a) (hc : c ≤ 0) : a * c ≤ b * c",
"start": [
400,
1
],
"end": [
404,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_mul_of_nonpos_left",
"code": "protected theorem mul_le_mul_of_nonpos_left {a b c : Int}\n (ha : a ≤ 0) (h : c ≤ b) : a * b ≤ a * c",
"start": [
406,
1
],
"end": [
409,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_ofNat",
"code": "@[simp] theorem natAbs_ofNat (n : Nat) : natAbs ↑n = n",
"start": [
413,
1
],
"end": [
413,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_negSucc",
"code": "@[simp] theorem natAbs_negSucc (n : Nat) : natAbs -[n+1] = n.succ",
"start": [
414,
1
],
"end": [
414,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_zero",
"code": "@[simp] theorem natAbs_zero : natAbs (0 : Int) = (0 : Nat)",
"start": [
415,
1
],
"end": [
415,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_one",
"code": "@[simp] theorem natAbs_one : natAbs (1 : Int) = (1 : Nat)",
"start": [
416,
1
],
"end": [
416,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_eq_zero",
"code": "@[simp] theorem natAbs_eq_zero : natAbs a = 0 ↔ a = 0",
"start": [
418,
1
],
"end": [
422,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_pos",
"code": "theorem natAbs_pos : 0 < natAbs a ↔ a ≠ 0",
"start": [
424,
1
],
"end": [
424,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_neg",
"code": "@[simp] theorem natAbs_neg : ∀ (a : Int), natAbs (-a) = natAbs a",
"start": [
426,
1
],
"end": [
429,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_eq",
"code": "theorem natAbs_eq : ∀ (a : Int), a = natAbs a ∨ a = -↑(natAbs a)",
"start": [
431,
1
],
"end": [
433,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_negOfNat",
"code": "theorem natAbs_negOfNat (n : Nat) : natAbs (negOfNat n) = n",
"start": [
435,
1
],
"end": [
436,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_mul",
"code": "theorem natAbs_mul (a b : Int) : natAbs (a * b) = natAbs a * natAbs b",
"start": [
438,
1
],
"end": [
440,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_eq_natAbs_iff",
"code": "theorem natAbs_eq_natAbs_iff {a b : Int} : a.natAbs = b.natAbs ↔ a = b ∨ a = -b",
"start": [
442,
1
],
"end": [
449,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_of_nonneg",
"code": "theorem natAbs_of_nonneg {a : Int} (H : 0 ≤ a) : (natAbs a : Int) = a",
"start": [
451,
1
],
"end": [
453,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_natAbs_of_nonpos",
"code": "theorem ofNat_natAbs_of_nonpos {a : Int} (H : a ≤ 0) : (natAbs a : Int) = -a",
"start": [
455,
1
],
"end": [
456,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_eq_max",
"code": "theorem toNat_eq_max : ∀ a : Int, (toNat a : Int) = max a 0",
"start": [
460,
1
],
"end": [
462,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_zero",
"code": "@[simp] theorem toNat_zero : (0 : Int).toNat = 0",
"start": [
464,
1
],
"end": [
464,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_one",
"code": "@[simp] theorem toNat_one : (1 : Int).toNat = 1",
"start": [
466,
1
],
"end": [
466,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_of_nonneg",
"code": "@[simp] theorem toNat_of_nonneg {a : Int} (h : 0 ≤ a) : (toNat a : Int) = a",
"start": [
468,
1
],
"end": [
469,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_ofNat",
"code": "@[simp] theorem toNat_ofNat (n : Nat) : toNat ↑n = n",
"start": [
471,
1
],
"end": [
471,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_ofNat_add_one",
"code": "@[simp] theorem toNat_ofNat_add_one {n : Nat} : ((n : Int) + 1).toNat = n + 1",
"start": [
473,
1
],
"end": [
473,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.self_le_toNat",
"code": "theorem self_le_toNat (a : Int) : a ≤ toNat a",
"start": [
475,
1
],
"end": [
475,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_toNat",
"code": "@[simp] theorem le_toNat {n : Nat} {z : Int} (h : 0 ≤ z) : n ≤ z.toNat ↔ (n : Int) ≤ z",
"start": [
477,
1
],
"end": [
478,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_lt",
"code": "@[simp] theorem toNat_lt {n : Nat} {z : Int} (h : 0 ≤ z) : z.toNat < n ↔ z < (n : Int)",
"start": [
480,
1
],
"end": [
481,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_add",
"code": "theorem toNat_add {a b : Int} (ha : 0 ≤ a) (hb : 0 ≤ b) : (a + b).toNat = a.toNat + b.toNat",
"start": [
483,
1
],
"end": [
485,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_add_nat",
"code": "theorem toNat_add_nat {a : Int} (ha : 0 ≤ a) (n : Nat) : (a + n).toNat = a.toNat + n",
"start": [
487,
1
],
"end": [
488,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.pred_toNat",
"code": "@[simp] theorem pred_toNat : ∀ i : Int, (i - 1).toNat = i.toNat - 1",
"start": [
490,
1
],
"end": [
493,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_sub_toNat_neg",
"code": "@[simp] theorem toNat_sub_toNat_neg : ∀ n : Int, ↑n.toNat - ↑(-n).toNat = n",
"start": [
495,
1
],
"end": [
498,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_add_toNat_neg_eq_natAbs",
"code": "@[simp] theorem toNat_add_toNat_neg_eq_natAbs : ∀ n : Int, n.toNat + (-n).toNat = n.natAbs",
"start": [
500,
1
],
"end": [
503,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.toNat_neg_nat",
"code": "@[simp] theorem toNat_neg_nat : ∀ n : Nat, (-(n : Int)).toNat = 0",
"start": [
505,
1
],
"end": [
507,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mem_toNat'",
"code": "theorem mem_toNat' : ∀ (a : Int) (n : Nat), toNat' a = some n ↔ a = n",
"start": [
511,
1
],
"end": [
513,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_not_le",
"code": "protected theorem le_of_not_le {a b : Int} : ¬ a ≤ b → b ≤ a",
"start": [
517,
1
],
"end": [
517,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_not_pos",
"code": "@[simp] theorem negSucc_not_pos (n : Nat) : 0 < -[n+1] ↔ False",
"start": [
519,
1
],
"end": [
520,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_negSucc_of_lt_zero",
"code": "theorem eq_negSucc_of_lt_zero : ∀ {a : Int}, a < 0 → ∃ n : Nat, a = -[n+1]",
"start": [
522,
1
],
"end": [
524,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_add_lt_add_left",
"code": "protected theorem lt_of_add_lt_add_left {a b c : Int} (h : a + b < a + c) : b < c",
"start": [
526,
1
],
"end": [
529,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_add_lt_add_right",
"code": "protected theorem lt_of_add_lt_add_right {a b c : Int} (h : a + b < c + b) : a < c",
"start": [
531,
1
],
"end": [
532,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_iff_left",
"code": "protected theorem add_lt_add_iff_left (a : Int) : a + b < a + c ↔ b < c",
"start": [
534,
1
],
"end": [
535,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_iff_right",
"code": "protected theorem add_lt_add_iff_right (c : Int) : a + c < b + c ↔ a < b",
"start": [
537,
1
],
"end": [
538,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add",
"code": "protected theorem add_lt_add {a b c d : Int} (h₁ : a < b) (h₂ : c < d) : a + c < b + d",
"start": [
540,
1
],
"end": [
541,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_of_le_of_lt",
"code": "protected theorem add_lt_add_of_le_of_lt {a b c d : Int} (h₁ : a ≤ b) (h₂ : c < d) :\n a + c < b + d",
"start": [
543,
1
],
"end": [
545,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_add_of_lt_of_le",
"code": "protected theorem add_lt_add_of_lt_of_le {a b c d : Int} (h₁ : a < b) (h₂ : c ≤ d) :\n a + c < b + d",
"start": [
547,
1
],
"end": [
549,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_pos_right",
"code": "protected theorem lt_add_of_pos_right (a : Int) {b : Int} (h : 0 < b) : a < a + b",
"start": [
551,
1
],
"end": [
553,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_pos_left",
"code": "protected theorem lt_add_of_pos_left (a : Int) {b : Int} (h : 0 < b) : a < b + a",
"start": [
555,
1
],
"end": [
557,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_nonneg",
"code": "protected theorem add_nonneg {a b : Int} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a + b",
"start": [
559,
1
],
"end": [
560,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_pos",
"code": "protected theorem add_pos {a b : Int} (ha : 0 < a) (hb : 0 < b) : 0 < a + b",
"start": [
562,
1
],
"end": [
563,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_pos_of_pos_of_nonneg",
"code": "protected theorem add_pos_of_pos_of_nonneg {a b : Int} (ha : 0 < a) (hb : 0 ≤ b) : 0 < a + b",
"start": [
565,
1
],
"end": [
566,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_pos_of_nonneg_of_pos",
"code": "protected theorem add_pos_of_nonneg_of_pos {a b : Int} (ha : 0 ≤ a) (hb : 0 < b) : 0 < a + b",
"start": [
568,
1
],
"end": [
569,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_nonpos",
"code": "protected theorem add_nonpos {a b : Int} (ha : a ≤ 0) (hb : b ≤ 0) : a + b ≤ 0",
"start": [
571,
1
],
"end": [
572,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg",
"code": "protected theorem add_neg {a b : Int} (ha : a < 0) (hb : b < 0) : a + b < 0",
"start": [
574,
1
],
"end": [
575,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg_of_neg_of_nonpos",
"code": "protected theorem add_neg_of_neg_of_nonpos {a b : Int} (ha : a < 0) (hb : b ≤ 0) : a + b < 0",
"start": [
577,
1
],
"end": [
578,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_neg_of_nonpos_of_neg",
"code": "protected theorem add_neg_of_nonpos_of_neg {a b : Int} (ha : a ≤ 0) (hb : b < 0) : a + b < 0",
"start": [
580,
1
],
"end": [
581,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_le_of_pos",
"code": "protected theorem lt_add_of_le_of_pos {a b c : Int} (hbc : b ≤ c) (ha : 0 < a) : b < c + a",
"start": [
583,
1
],
"end": [
584,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_one_le_iff",
"code": "theorem add_one_le_iff {a b : Int} : a + 1 ≤ b ↔ a < b",
"start": [
586,
1
],
"end": [
586,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_one_iff",
"code": "theorem lt_add_one_iff {a b : Int} : a < b + 1 ↔ a ≤ b",
"start": [
588,
1
],
"end": [
588,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.succ_ofNat_pos",
"code": "@[simp] theorem succ_ofNat_pos (n : Nat) : 0 < (n : Int) + 1",
"start": [
590,
1
],
"end": [
591,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.not_ofNat_neg",
"code": "theorem not_ofNat_neg (n : Nat) : ¬((n : Int) < 0)",
"start": [
593,
1
],
"end": [
594,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_one",
"code": "theorem le_add_one {a b : Int} (h : a ≤ b) : a ≤ b + 1",
"start": [
596,
1
],
"end": [
597,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.nonneg_of_neg_nonpos",
"code": "protected theorem nonneg_of_neg_nonpos {a : Int} (h : -a ≤ 0) : 0 ≤ a",
"start": [
599,
1
],
"end": [
600,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.nonpos_of_neg_nonneg",
"code": "protected theorem nonpos_of_neg_nonneg {a : Int} (h : 0 ≤ -a) : a ≤ 0",
"start": [
602,
1
],
"end": [
603,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_neg_lt_neg",
"code": "protected theorem lt_of_neg_lt_neg {a b : Int} (h : -b < -a) : a < b",
"start": [
605,
1
],
"end": [
606,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.pos_of_neg_neg",
"code": "protected theorem pos_of_neg_neg {a : Int} (h : -a < 0) : 0 < a",
"start": [
608,
1
],
"end": [
609,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_of_neg_pos",
"code": "protected theorem neg_of_neg_pos {a : Int} (h : 0 < -a) : a < 0",
"start": [
611,
1
],
"end": [
613,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_neg_of_le_neg",
"code": "protected theorem le_neg_of_le_neg {a b : Int} (h : a ≤ -b) : b ≤ -a",
"start": [
615,
1
],
"end": [
617,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_le_of_neg_le",
"code": "protected theorem neg_le_of_neg_le {a b : Int} (h : -a ≤ b) : -b ≤ a",
"start": [
619,
1
],
"end": [
621,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_neg_of_lt_neg",
"code": "protected theorem lt_neg_of_lt_neg {a b : Int} (h : a < -b) : b < -a",
"start": [
623,
1
],
"end": [
625,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_lt_of_neg_lt",
"code": "protected theorem neg_lt_of_neg_lt {a b : Int} (h : -a < b) : -b < a",
"start": [
627,
1
],
"end": [
629,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_nonpos_of_le",
"code": "protected theorem sub_nonpos_of_le {a b : Int} (h : a ≤ b) : a - b ≤ 0",
"start": [
631,
1
],
"end": [
633,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_sub_nonpos",
"code": "protected theorem le_of_sub_nonpos {a b : Int} (h : a - b ≤ 0) : a ≤ b",
"start": [
635,
1
],
"end": [
637,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_neg_of_lt",
"code": "protected theorem sub_neg_of_lt {a b : Int} (h : a < b) : a - b < 0",
"start": [
639,
1
],
"end": [
641,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_sub_neg",
"code": "protected theorem lt_of_sub_neg {a b : Int} (h : a - b < 0) : a < b",
"start": [
643,
1
],
"end": [
645,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_of_le_neg_add",
"code": "protected theorem add_le_of_le_neg_add {a b c : Int} (h : b ≤ -a + c) : a + b ≤ c",
"start": [
647,
1
],
"end": [
649,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_neg_add_of_add_le",
"code": "protected theorem le_neg_add_of_add_le {a b c : Int} (h : a + b ≤ c) : b ≤ -a + c",
"start": [
651,
1
],
"end": [
653,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_of_le_sub_left",
"code": "protected theorem add_le_of_le_sub_left {a b c : Int} (h : b ≤ c - a) : a + b ≤ c",
"start": [
655,
1
],
"end": [
657,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_sub_left_of_add_le",
"code": "protected theorem le_sub_left_of_add_le {a b c : Int} (h : a + b ≤ c) : b ≤ c - a",
"start": [
659,
1
],
"end": [
661,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_of_le_sub_right",
"code": "protected theorem add_le_of_le_sub_right {a b c : Int} (h : a ≤ c - b) : a + b ≤ c",
"start": [
663,
1
],
"end": [
665,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_sub_right_of_add_le",
"code": "protected theorem le_sub_right_of_add_le {a b c : Int} (h : a + b ≤ c) : a ≤ c - b",
"start": [
667,
1
],
"end": [
669,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_neg_add_le",
"code": "protected theorem le_add_of_neg_add_le {a b c : Int} (h : -b + a ≤ c) : a ≤ b + c",
"start": [
671,
1
],
"end": [
673,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_le_of_le_add",
"code": "protected theorem neg_add_le_of_le_add {a b c : Int} (h : a ≤ b + c) : -b + a ≤ c",
"start": [
675,
1
],
"end": [
677,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_sub_left_le",
"code": "protected theorem le_add_of_sub_left_le {a b c : Int} (h : a - b ≤ c) : a ≤ b + c",
"start": [
679,
1
],
"end": [
681,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_sub_right_le",
"code": "protected theorem le_add_of_sub_right_le {a b c : Int} (h : a - c ≤ b) : a ≤ b + c",
"start": [
683,
1
],
"end": [
685,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_right_le_of_le_add",
"code": "protected theorem sub_right_le_of_le_add {a b c : Int} (h : a ≤ b + c) : a - c ≤ b",
"start": [
687,
1
],
"end": [
689,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_neg_add_le_left",
"code": "protected theorem le_add_of_neg_add_le_left {a b c : Int} (h : -b + a ≤ c) : a ≤ b + c",
"start": [
691,
1
],
"end": [
693,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_le_left_of_le_add",
"code": "protected theorem neg_add_le_left_of_le_add {a b c : Int} (h : a ≤ b + c) : -b + a ≤ c",
"start": [
695,
1
],
"end": [
697,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_neg_add_le_right",
"code": "protected theorem le_add_of_neg_add_le_right {a b c : Int} (h : -c + a ≤ b) : a ≤ b + c",
"start": [
699,
1
],
"end": [
701,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_le_right_of_le_add",
"code": "protected theorem neg_add_le_right_of_le_add {a b c : Int} (h : a ≤ b + c) : -c + a ≤ b",
"start": [
703,
1
],
"end": [
705,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_neg_le_sub_left",
"code": "protected theorem le_add_of_neg_le_sub_left {a b c : Int} (h : -a ≤ b - c) : c ≤ a + b",
"start": [
707,
1
],
"end": [
708,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_le_sub_left_of_le_add",
"code": "protected theorem neg_le_sub_left_of_le_add {a b c : Int} (h : c ≤ a + b) : -a ≤ b - c",
"start": [
710,
1
],
"end": [
712,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_add_of_neg_le_sub_right",
"code": "protected theorem le_add_of_neg_le_sub_right {a b c : Int} (h : -b ≤ a - c) : c ≤ a + b",
"start": [
714,
1
],
"end": [
715,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_le_sub_right_of_le_add",
"code": "protected theorem neg_le_sub_right_of_le_add {a b c : Int} (h : c ≤ a + b) : -b ≤ a - c",
"start": [
717,
1
],
"end": [
718,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_le_of_sub_le",
"code": "protected theorem sub_le_of_sub_le {a b c : Int} (h : a - b ≤ c) : a - c ≤ b",
"start": [
720,
1
],
"end": [
721,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_le_sub_left",
"code": "protected theorem sub_le_sub_left {a b : Int} (h : a ≤ b) (c : Int) : c - b ≤ c - a",
"start": [
723,
1
],
"end": [
724,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_le_sub_right",
"code": "protected theorem sub_le_sub_right {a b : Int} (h : a ≤ b) (c : Int) : a - c ≤ b - c",
"start": [
726,
1
],
"end": [
727,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_le_sub",
"code": "protected theorem sub_le_sub {a b c d : Int} (hab : a ≤ b) (hcd : c ≤ d) : a - d ≤ b - c",
"start": [
729,
1
],
"end": [
730,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_of_lt_neg_add",
"code": "protected theorem add_lt_of_lt_neg_add {a b c : Int} (h : b < -a + c) : a + b < c",
"start": [
732,
1
],
"end": [
734,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_neg_add_of_add_lt",
"code": "protected theorem lt_neg_add_of_add_lt {a b c : Int} (h : a + b < c) : b < -a + c",
"start": [
736,
1
],
"end": [
738,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_of_lt_sub_left",
"code": "protected theorem add_lt_of_lt_sub_left {a b c : Int} (h : b < c - a) : a + b < c",
"start": [
740,
1
],
"end": [
742,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_sub_left_of_add_lt",
"code": "protected theorem lt_sub_left_of_add_lt {a b c : Int} (h : a + b < c) : b < c - a",
"start": [
744,
1
],
"end": [
746,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_of_lt_sub_right",
"code": "protected theorem add_lt_of_lt_sub_right {a b c : Int} (h : a < c - b) : a + b < c",
"start": [
748,
1
],
"end": [
750,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_sub_right_of_add_lt",
"code": "protected theorem lt_sub_right_of_add_lt {a b c : Int} (h : a + b < c) : a < c - b",
"start": [
752,
1
],
"end": [
754,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_neg_add_lt",
"code": "protected theorem lt_add_of_neg_add_lt {a b c : Int} (h : -b + a < c) : a < b + c",
"start": [
756,
1
],
"end": [
758,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_lt_of_lt_add",
"code": "protected theorem neg_add_lt_of_lt_add {a b c : Int} (h : a < b + c) : -b + a < c",
"start": [
760,
1
],
"end": [
762,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_sub_left_lt",
"code": "protected theorem lt_add_of_sub_left_lt {a b c : Int} (h : a - b < c) : a < b + c",
"start": [
764,
1
],
"end": [
766,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_left_lt_of_lt_add",
"code": "protected theorem sub_left_lt_of_lt_add {a b c : Int} (h : a < b + c) : a - b < c",
"start": [
768,
1
],
"end": [
770,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_sub_right_lt",
"code": "protected theorem lt_add_of_sub_right_lt {a b c : Int} (h : a - c < b) : a < b + c",
"start": [
772,
1
],
"end": [
774,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_right_lt_of_lt_add",
"code": "protected theorem sub_right_lt_of_lt_add {a b c : Int} (h : a < b + c) : a - c < b",
"start": [
776,
1
],
"end": [
778,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_neg_add_lt_left",
"code": "protected theorem lt_add_of_neg_add_lt_left {a b c : Int} (h : -b + a < c) : a < b + c",
"start": [
780,
1
],
"end": [
782,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_lt_left_of_lt_add",
"code": "protected theorem neg_add_lt_left_of_lt_add {a b c : Int} (h : a < b + c) : -b + a < c",
"start": [
784,
1
],
"end": [
786,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_neg_add_lt_right",
"code": "protected theorem lt_add_of_neg_add_lt_right {a b c : Int} (h : -c + a < b) : a < b + c",
"start": [
788,
1
],
"end": [
790,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_add_lt_right_of_lt_add",
"code": "protected theorem neg_add_lt_right_of_lt_add {a b c : Int} (h : a < b + c) : -c + a < b",
"start": [
792,
1
],
"end": [
794,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_neg_lt_sub_left",
"code": "protected theorem lt_add_of_neg_lt_sub_left {a b c : Int} (h : -a < b - c) : c < a + b",
"start": [
796,
1
],
"end": [
797,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_lt_sub_left_of_lt_add",
"code": "protected theorem neg_lt_sub_left_of_lt_add {a b c : Int} (h : c < a + b) : -a < b - c",
"start": [
799,
1
],
"end": [
801,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_of_neg_lt_sub_right",
"code": "protected theorem lt_add_of_neg_lt_sub_right {a b c : Int} (h : -b < a - c) : c < a + b",
"start": [
803,
1
],
"end": [
804,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_lt_sub_right_of_lt_add",
"code": "protected theorem neg_lt_sub_right_of_lt_add {a b c : Int} (h : c < a + b) : -b < a - c",
"start": [
806,
1
],
"end": [
807,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_lt_iff",
"code": "protected theorem add_lt_iff (a b c : Int) : a + b < c ↔ a < -b + c",
"start": [
809,
1
],
"end": [
810,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_iff",
"code": "protected theorem sub_lt_iff (a b c : Int) : a - b < c ↔ a < c + b",
"start": [
812,
1
],
"end": [
813,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_of_sub_lt",
"code": "protected theorem sub_lt_of_sub_lt {a b c : Int} (h : a - b < c) : a - c < b",
"start": [
815,
1
],
"end": [
816,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_left",
"code": "protected theorem sub_lt_sub_left {a b : Int} (h : a < b) (c : Int) : c - b < c - a",
"start": [
818,
1
],
"end": [
819,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_right",
"code": "protected theorem sub_lt_sub_right {a b : Int} (h : a < b) (c : Int) : a - c < b - c",
"start": [
821,
1
],
"end": [
822,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub",
"code": "protected theorem sub_lt_sub {a b c d : Int} (hab : a < b) (hcd : c < d) : a - d < b - c",
"start": [
824,
1
],
"end": [
825,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_sub_lt_sub_left",
"code": "protected theorem lt_of_sub_lt_sub_left {a b c : Int} (h : c - a < c - b) : b < a",
"start": [
827,
1
],
"end": [
828,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_sub_lt_sub_right",
"code": "protected theorem lt_of_sub_lt_sub_right {a b c : Int} (h : a - c < b - c) : a < b",
"start": [
830,
1
],
"end": [
831,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_left_iff",
"code": "@[simp] protected theorem sub_lt_sub_left_iff (a b c : Int) :\n c - a < c - b ↔ b < a",
"start": [
833,
1
],
"end": [
835,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_right_iff",
"code": "@[simp] protected theorem sub_lt_sub_right_iff (a b c : Int) :\n a - c < b - c ↔ a < b",
"start": [
837,
1
],
"end": [
839,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_of_le_of_lt",
"code": "protected theorem sub_lt_sub_of_le_of_lt {a b c d : Int}\n (hab : a ≤ b) (hcd : c < d) : a - d < b - c",
"start": [
841,
1
],
"end": [
843,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_lt_sub_of_lt_of_le",
"code": "protected theorem sub_lt_sub_of_lt_of_le {a b c d : Int}\n (hab : a < b) (hcd : c ≤ d) : a - d < b - c",
"start": [
845,
1
],
"end": [
847,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_le_add_three",
"code": "protected theorem add_le_add_three {a b c d e f : Int}\n (h₁ : a ≤ d) (h₂ : b ≤ e) (h₃ : c ≤ f) : a + b + c ≤ d + e + f",
"start": [
849,
1
],
"end": [
851,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.exists_eq_neg_ofNat",
"code": "theorem exists_eq_neg_ofNat {a : Int} (H : a ≤ 0) : ∃ n : Nat, a = -(n : Int)",
"start": [
853,
1
],
"end": [
855,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_add_one_le",
"code": "theorem lt_of_add_one_le {a b : Int} (H : a + 1 ≤ b) : a < b",
"start": [
857,
1
],
"end": [
857,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_add_one_of_le",
"code": "theorem lt_add_one_of_le {a b : Int} (H : a ≤ b) : a < b + 1",
"start": [
859,
1
],
"end": [
859,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_lt_add_one",
"code": "theorem le_of_lt_add_one {a b : Int} (H : a < b + 1) : a ≤ b",
"start": [
861,
1
],
"end": [
861,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_one_lt_of_le",
"code": "theorem sub_one_lt_of_le {a b : Int} (H : a ≤ b) : a - 1 < b",
"start": [
863,
1
],
"end": [
864,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_sub_one_lt",
"code": "theorem le_of_sub_one_lt {a b : Int} (H : a - 1 < b) : a ≤ b",
"start": [
866,
1
],
"end": [
867,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_sub_one_of_lt",
"code": "theorem le_sub_one_of_lt {a b : Int} (H : a < b) : a ≤ b - 1",
"start": [
869,
1
],
"end": [
869,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_le_sub_one",
"code": "theorem lt_of_le_sub_one {a b : Int} (H : a ≤ b - 1) : a < b",
"start": [
871,
1
],
"end": [
871,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul",
"code": "protected theorem mul_lt_mul {a b c d : Int}\n (h₁ : a < c) (h₂ : b ≤ d) (h₃ : 0 < b) (h₄ : 0 ≤ c) : a * b < c * d",
"start": [
875,
1
],
"end": [
877,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul'",
"code": "protected theorem mul_lt_mul' {a b c d : Int}\n (h₁ : a ≤ c) (h₂ : b < d) (h₃ : 0 ≤ b) (h₄ : 0 < c) : a * b < c * d",
"start": [
879,
1
],
"end": [
881,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_neg_of_pos_of_neg",
"code": "protected theorem mul_neg_of_pos_of_neg {a b : Int} (ha : 0 < a) (hb : b < 0) : a * b < 0",
"start": [
883,
1
],
"end": [
885,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_neg_of_neg_of_pos",
"code": "protected theorem mul_neg_of_neg_of_pos {a b : Int} (ha : a < 0) (hb : 0 < b) : a * b < 0",
"start": [
887,
1
],
"end": [
889,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_nonneg_of_nonpos_of_nonpos",
"code": "protected theorem mul_nonneg_of_nonpos_of_nonpos {a b : Int}\n (ha : a ≤ 0) (hb : b ≤ 0) : 0 ≤ a * b",
"start": [
891,
1
],
"end": [
894,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul_of_neg_left",
"code": "protected theorem mul_lt_mul_of_neg_left {a b c : Int} (h : b < a) (hc : c < 0) : c * a < c * b",
"start": [
896,
1
],
"end": [
901,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_mul_of_neg_right",
"code": "protected theorem mul_lt_mul_of_neg_right {a b c : Int} (h : b < a) (hc : c < 0) : a * c < b * c",
"start": [
903,
1
],
"end": [
908,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_pos_of_neg_of_neg",
"code": "protected theorem mul_pos_of_neg_of_neg {a b : Int} (ha : a < 0) (hb : b < 0) : 0 < a * b",
"start": [
910,
1
],
"end": [
912,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_self_le_mul_self",
"code": "protected theorem mul_self_le_mul_self {a b : Int} (h1 : 0 ≤ a) (h2 : a ≤ b) : a * a ≤ b * b",
"start": [
914,
1
],
"end": [
915,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_self_lt_mul_self",
"code": "protected theorem mul_self_lt_mul_self {a b : Int} (h1 : 0 ≤ a) (h2 : a < b) : a * a < b * b",
"start": [
917,
1
],
"end": [
918,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_zero",
"code": "@[simp] theorem sign_zero : sign 0 = 0",
"start": [
922,
1
],
"end": [
922,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_one",
"code": "@[simp] theorem sign_one : sign 1 = 1",
"start": [
923,
1
],
"end": [
923,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_neg_one",
"code": "theorem sign_neg_one : sign (-1) = -1",
"start": [
924,
1
],
"end": [
924,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_of_add_one",
"code": "@[simp] theorem sign_of_add_one (x : Nat) : Int.sign (x + 1) = 1",
"start": [
926,
1
],
"end": [
926,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_negSucc",
"code": "@[simp] theorem sign_negSucc (x : Nat) : Int.sign (Int.negSucc x) = -1",
"start": [
927,
1
],
"end": [
927,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_sign",
"code": "theorem natAbs_sign (z : Int) : z.sign.natAbs = if z = 0 then 0 else 1",
"start": [
929,
1
],
"end": [
930,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_sign_of_nonzero",
"code": "theorem natAbs_sign_of_nonzero {z : Int} (hz : z ≠ 0) : z.sign.natAbs = 1",
"start": [
932,
1
],
"end": [
933,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_ofNat_of_nonzero",
"code": "theorem sign_ofNat_of_nonzero {n : Nat} (hn : n ≠ 0) : Int.sign n = 1",
"start": [
935,
1
],
"end": [
937,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_neg",
"code": "@[simp] theorem sign_neg (z : Int) : Int.sign (-z) = -Int.sign z",
"start": [
939,
1
],
"end": [
940,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_mul_natAbs",
"code": "theorem sign_mul_natAbs : ∀ a : Int, sign a * natAbs a = a",
"start": [
942,
1
],
"end": [
945,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_mul",
"code": "@[simp] theorem sign_mul : ∀ a b, sign (a * b) = sign a * sign b",
"start": [
947,
1
],
"end": [
949,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_one_of_pos",
"code": "theorem sign_eq_one_of_pos {a : Int} (h : 0 < a) : sign a = 1",
"start": [
951,
1
],
"end": [
953,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_neg_one_of_neg",
"code": "theorem sign_eq_neg_one_of_neg {a : Int} (h : a < 0) : sign a = -1",
"start": [
955,
1
],
"end": [
957,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_zero_of_sign_eq_zero",
"code": "theorem eq_zero_of_sign_eq_zero : ∀ {a : Int}, sign a = 0 → a = 0",
"start": [
959,
1
],
"end": [
960,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.pos_of_sign_eq_one",
"code": "theorem pos_of_sign_eq_one : ∀ {a : Int}, sign a = 1 → 0 < a",
"start": [
962,
1
],
"end": [
963,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_of_sign_eq_neg_one",
"code": "theorem neg_of_sign_eq_neg_one : ∀ {a : Int}, sign a = -1 → a < 0",
"start": [
965,
1
],
"end": [
968,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_one_iff_pos",
"code": "theorem sign_eq_one_iff_pos (a : Int) : sign a = 1 ↔ 0 < a",
"start": [
970,
1
],
"end": [
971,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_neg_one_iff_neg",
"code": "theorem sign_eq_neg_one_iff_neg (a : Int) : sign a = -1 ↔ a < 0",
"start": [
973,
1
],
"end": [
974,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_zero_iff_zero",
"code": "@[simp] theorem sign_eq_zero_iff_zero (a : Int) : sign a = 0 ↔ a = 0",
"start": [
976,
1
],
"end": [
977,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_sign",
"code": "@[simp] theorem sign_sign : sign (sign x) = sign x",
"start": [
979,
1
],
"end": [
983,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_nonneg",
"code": "@[simp] theorem sign_nonneg : 0 ≤ sign x ↔ 0 ≤ x",
"start": [
985,
1
],
"end": [
991,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_sign",
"code": "theorem mul_sign : ∀ i : Int, i * sign i = natAbs i",
"start": [
993,
1
],
"end": [
996,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_ne_zero",
"code": "theorem natAbs_ne_zero {a : Int} : a.natAbs ≠ 0 ↔ a ≠ 0",
"start": [
1000,
1
],
"end": [
1000,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_mul_self",
"code": "theorem natAbs_mul_self : ∀ {a : Int}, ↑(natAbs a * natAbs a) = a * a",
"start": [
1002,
1
],
"end": [
1004,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_nat_or_neg",
"code": "theorem eq_nat_or_neg (a : Int) : ∃ n : Nat, a = n ∨ a = -↑n",
"start": [
1006,
1
],
"end": [
1006,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_mul_natAbs_eq",
"code": "theorem natAbs_mul_natAbs_eq {a b : Int} {c : Nat}\n (h : a * b = (c : Int)) : a.natAbs * b.natAbs = c",
"start": [
1008,
1
],
"end": [
1009,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_mul_self'",
"code": "@[simp] theorem natAbs_mul_self' (a : Int) : (natAbs a * natAbs a : Int) = a * a",
"start": [
1011,
1
],
"end": [
1012,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_eq_iff",
"code": "theorem natAbs_eq_iff {a : Int} {n : Nat} : a.natAbs = n ↔ a = n ∨ a = -↑n",
"start": [
1014,
1
],
"end": [
1015,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_add_le",
"code": "theorem natAbs_add_le (a b : Int) : natAbs (a + b) ≤ natAbs a + natAbs b",
"start": [
1017,
1
],
"end": [
1034,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_sub_le",
"code": "theorem natAbs_sub_le (a b : Int) : natAbs (a - b) ≤ natAbs a + natAbs b",
"start": [
1036,
1
],
"end": [
1037,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_eq'",
"code": "theorem negSucc_eq' (m : Nat) : -[m+1] = -m - 1",
"start": [
1039,
1
],
"end": [
1039,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_lt_natAbs_of_nonneg_of_lt",
"code": "theorem natAbs_lt_natAbs_of_nonneg_of_lt {a b : Int}\n (w₁ : 0 ≤ a) (w₂ : a < b) : a.natAbs < b.natAbs",
"start": [
1041,
1
],
"end": [
1044,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_natAbs_iff_mul_eq_zero",
"code": "theorem eq_natAbs_iff_mul_eq_zero : natAbs a = n ↔ (a - n) * (a + n) = 0",
"start": [
1046,
1
],
"end": [
1047,
87
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Int/DivMod.lean | [
".lake/packages/lean4/src/lean/Init/Data/Int/Basic.lean"
] | [
{
"full_name": "Int.div",
"code": "@[extern \"lean_int_div\"]\ndef div : (@& Int) → (@& Int) → Int\n | ofNat m, ofNat n => ofNat (m / n)\n | ofNat m, -[n +1] => -ofNat (m / succ n)\n | -[m +1], ofNat n => -ofNat (succ m / n)\n | -[m +1], -[n +1] => ofNat (succ m / succ n)",
"start": [
23,
1
],
"end": [
60,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod",
"code": "@[extern \"lean_int_mod\"]\ndef mod : (@& Int) → (@& Int) → Int\n | ofNat m, ofNat n => ofNat (m % n)\n | ofNat m, -[n +1] => ofNat (m % succ n)\n | -[m +1], ofNat n => -ofNat (succ m % n)\n | -[m +1], -[n +1] => -ofNat (succ m % succ n)",
"start": [
62,
1
],
"end": [
94,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv",
"code": "def fdiv : Int → Int → Int\n | 0, _ => 0\n | ofNat m, ofNat n => ofNat (m / n)\n | ofNat (succ m), -[n+1] => -[m / succ n +1]\n | -[_+1], 0 => 0\n | -[m+1], ofNat (succ n) => -[m / succ n +1]\n | -[m+1], -[n+1] => ofNat (succ m / succ n)",
"start": [
100,
1
],
"end": [
111,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod",
"code": "def fmod : Int → Int → Int\n | 0, _ => 0\n | ofNat m, ofNat n => ofNat (m % n)\n | ofNat (succ m), -[n+1] => subNatNat (m % succ n) n\n | -[m+1], ofNat n => subNatNat n (succ (m % n))\n | -[m+1], -[n+1] => -ofNat (succ m % succ n)",
"start": [
113,
1
],
"end": [
123,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv",
"code": "@[extern \"lean_int_ediv\"]\ndef ediv : (@& Int) → (@& Int) → Int\n | ofNat m, ofNat n => ofNat (m / n)\n | ofNat m, -[n+1] => -ofNat (m / succ n)\n | -[_+1], 0 => 0\n | -[m+1], ofNat (succ n) => -[m / succ n +1]\n | -[m+1], -[n+1] => ofNat (succ (m / succ n))",
"start": [
129,
1
],
"end": [
140,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod",
"code": "@[extern \"lean_int_emod\"]\ndef emod : (@& Int) → (@& Int) → Int\n | ofNat m, n => ofNat (m % natAbs n)\n | -[m+1], n => subNatNat (natAbs n) (succ (m % natAbs n))",
"start": [
142,
1
],
"end": [
150,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_ediv",
"code": "@[simp, norm_cast] theorem ofNat_ediv (m n : Nat) : (↑(m / n) : Int) = ↑m / ↑n",
"start": [
161,
1
],
"end": [
161,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_div",
"code": "theorem ofNat_div (m n : Nat) : ↑(m / n) = div ↑m ↑n",
"start": [
163,
1
],
"end": [
163,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_fdiv",
"code": "theorem ofNat_fdiv : ∀ m n : Nat, ↑(m / n) = fdiv ↑m ↑n",
"start": [
165,
1
],
"end": [
167,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod",
"code": "def bmod (x : Int) (m : Nat) : Int :=\n let r := x % m\n if r < (m + 1) / 2 then\n r\n else\n r - m",
"start": [
179,
1
],
"end": [
192,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bdiv",
"code": "def bdiv (x : Int) (m : Nat) : Int :=\n if m = 0 then\n 0\n else\n let q := x / m\n let r := x % m\n if r < (m + 1) / 2 then\n q\n else\n q + 1",
"start": [
194,
1
],
"end": [
207,
12
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/Lawful/Basic.lean | [
".lake/packages/lean4/src/lean/Init/SimpLemmas.lean",
".lake/packages/lean4/src/lean/Init/Meta.lean"
] | [
{
"full_name": "monadLift_self",
"code": "@[simp] theorem monadLift_self {m : Type u → Type v} (x : m α) : monadLift x = x",
"start": [
12,
1
],
"end": [
13,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulFunctor",
"code": "class LawfulFunctor (f : Type u → Type v) [Functor f] : Prop where\n map_const : (Functor.mapConst : α → f β → f α) = Functor.map ∘ const β\n id_map (x : f α) : id <$> x = x\n comp_map (g : α → β) (h : β → γ) (x : f α) : (h ∘ g) <$> x = h <$> g <$> x",
"start": [
15,
1
],
"end": [
27,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "id_map'",
"code": "@[simp] theorem id_map' [Functor m] [LawfulFunctor m] (x : m α) : (fun a => a) <$> x = x",
"start": [
33,
1
],
"end": [
34,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulApplicative",
"code": "class LawfulApplicative (f : Type u → Type v) [Applicative f] extends LawfulFunctor f : Prop where\n seqLeft_eq (x : f α) (y : f β) : x <* y = const β <$> x <*> y\n seqRight_eq (x : f α) (y : f β) : x *> y = const α id <$> x <*> y\n pure_seq (g : α → β) (x : f α) : pure g <*> x = g <$> x\n map_pure (g : α → β) (x : α) : g <$> (pure x : f α) = pure (g x)\n seq_pure {α β : Type u} (g : f (α → β)) (x : α) : g <*> pure x = (fun h => h x) <$> g\n seq_assoc {α β γ : Type u} (x : f α) (g : f (α → β)) (h : f (β → γ)) : h <*> (g <*> x) = ((@comp α β γ) <$> h) <*> g <*> x\n comp_map g h x := (by\n repeat rw [← pure_seq]\n simp [seq_assoc, map_pure, seq_pure])",
"start": [
36,
1
],
"end": [
55,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "pure_id_seq",
"code": "@[simp] theorem pure_id_seq [Applicative f] [LawfulApplicative f] (x : f α) : pure id <*> x = x",
"start": [
61,
1
],
"end": [
62,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulMonad",
"code": "class LawfulMonad (m : Type u → Type v) [Monad m] extends LawfulApplicative m : Prop where\n bind_pure_comp (f : α → β) (x : m α) : x >>= (fun a => pure (f a)) = f <$> x\n bind_map {α β : Type u} (f : m (α → β)) (x : m α) : f >>= (. <$> x) = f <*> x\n pure_bind (x : α) (f : α → m β) : pure x >>= f = f x\n bind_assoc (x : m α) (f : α → m β) (g : β → m γ) : x >>= f >>= g = x >>= fun x => f x >>= g\n map_pure g x := (by rw [← bind_pure_comp, pure_bind])\n seq_pure g x := (by rw [← bind_map]; simp [map_pure, bind_pure_comp])\n seq_assoc x g h := (by simp [← bind_pure_comp, ← bind_map, bind_assoc, pure_bind])",
"start": [
64,
1
],
"end": [
83,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "bind_pure",
"code": "@[simp] theorem bind_pure [Monad m] [LawfulMonad m] (x : m α) : x >>= pure = x",
"start": [
88,
1
],
"end": [
90,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "map_eq_pure_bind",
"code": "theorem map_eq_pure_bind [Monad m] [LawfulMonad m] (f : α → β) (x : m α) : f <$> x = x >>= fun a => pure (f a)",
"start": [
92,
1
],
"end": [
93,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "seq_eq_bind_map",
"code": "theorem seq_eq_bind_map {α β : Type u} [Monad m] [LawfulMonad m] (f : m (α → β)) (x : m α) : f <*> x = f >>= (. <$> x)",
"start": [
95,
1
],
"end": [
96,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "bind_congr",
"code": "theorem bind_congr [Bind m] {x : m α} {f g : α → m β} (h : ∀ a, f a = g a) : x >>= f = x >>= g",
"start": [
98,
1
],
"end": [
99,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "bind_pure_unit",
"code": "@[simp] theorem bind_pure_unit [Monad m] [LawfulMonad m] {x : m PUnit} : (x >>= fun _ => pure ⟨⟩) = x",
"start": [
101,
1
],
"end": [
102,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "map_congr",
"code": "theorem map_congr [Functor m] {x : m α} {f g : α → β} (h : ∀ a, f a = g a) : (f <$> x : m β) = g <$> x",
"start": [
104,
1
],
"end": [
105,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "seq_eq_bind",
"code": "theorem seq_eq_bind {α β : Type u} [Monad m] [LawfulMonad m] (mf : m (α → β)) (x : m α) : mf <*> x = mf >>= fun f => f <$> x",
"start": [
107,
1
],
"end": [
108,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "seqRight_eq_bind",
"code": "theorem seqRight_eq_bind [Monad m] [LawfulMonad m] (x : m α) (y : m β) : x *> y = x >>= fun _ => y",
"start": [
110,
1
],
"end": [
112,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "seqLeft_eq_bind",
"code": "theorem seqLeft_eq_bind [Monad m] [LawfulMonad m] (x : m α) (y : m β) : x <* y = x >>= fun a => y >>= fun _ => pure a",
"start": [
114,
1
],
"end": [
115,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "LawfulMonad.mk'",
"code": "theorem LawfulMonad.mk' (m : Type u → Type v) [Monad m]\n (id_map : ∀ {α} (x : m α), id <$> x = x)\n (pure_bind : ∀ {α β} (x : α) (f : α → m β), pure x >>= f = f x)\n (bind_assoc : ∀ {α β γ} (x : m α) (f : α → m β) (g : β → m γ),\n x >>= f >>= g = x >>= fun x => f x >>= g)\n (map_const : ∀ {α β} (x : α) (y : m β),\n Functor.mapConst x y = Function.const β x <$> y := by intros; rfl)\n (seqLeft_eq : ∀ {α β} (x : m α) (y : m β),\n x <* y = (x >>= fun a => y >>= fun _ => pure a) := by intros; rfl)\n (seqRight_eq : ∀ {α β} (x : m α) (y : m β), x *> y = (x >>= fun _ => y) := by intros; rfl)\n (bind_pure_comp : ∀ {α β} (f : α → β) (x : m α),\n x >>= (fun y => pure (f y)) = f <$> x := by intros; rfl)\n (bind_map : ∀ {α β} (f : m (α → β)) (x : m α), f >>= (. <$> x) = f <*> x := by intros; rfl)\n : LawfulMonad m",
"start": [
117,
1
],
"end": [
145,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.map_eq",
"code": "@[simp] theorem map_eq (x : Id α) (f : α → β) : f <$> x = f x",
"start": [
151,
1
],
"end": [
151,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.bind_eq",
"code": "@[simp] theorem bind_eq (x : Id α) (f : α → id β) : x >>= f = f x",
"start": [
152,
1
],
"end": [
152,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Id.pure_eq",
"code": "@[simp] theorem pure_eq (a : α) : (pure a : Id α) = a",
"start": [
153,
1
],
"end": [
153,
61
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Hints.lean | [
".lake/packages/lean4/src/lean/Init/NotationExtra.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Bool.lean | [
".lake/packages/lean4/src/lean/Init/BinderPredicates.lean"
] | [
{
"full_name": "xor",
"code": "abbrev xor : Bool → Bool → Bool := bne",
"start": [
9,
1
],
"end": [
10,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not",
"code": "@[inherit_doc not] protected abbrev not := not",
"start": [
15,
1
],
"end": [
15,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or",
"code": "@[inherit_doc or] protected abbrev or := or",
"start": [
16,
1
],
"end": [
16,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and",
"code": "@[inherit_doc and] protected abbrev and := and",
"start": [
17,
1
],
"end": [
17,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor",
"code": "@[inherit_doc xor] protected abbrev xor := xor",
"start": [
18,
1
],
"end": [
18,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.default_bool",
"code": "@[simp] theorem default_bool : default = false",
"start": [
32,
1
],
"end": [
32,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_ne_true",
"code": "theorem false_ne_true : false ≠ true",
"start": [
43,
1
],
"end": [
43,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_or_eq_true",
"code": "theorem eq_false_or_eq_true : (b : Bool) → b = true ∨ b = false",
"start": [
45,
1
],
"end": [
45,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_iff",
"code": "theorem eq_false_iff : {b : Bool} → b = false ↔ b ≠ true",
"start": [
47,
1
],
"end": [
47,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.ne_false_iff",
"code": "theorem ne_false_iff : {b : Bool} → b ≠ false ↔ b = true",
"start": [
49,
1
],
"end": [
49,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_iff_iff",
"code": "theorem eq_iff_iff {a b : Bool} : a = b ↔ (a ↔ b)",
"start": [
51,
1
],
"end": [
51,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_eq_true",
"code": "@[simp] theorem decide_eq_true {b : Bool} [Decidable (b = true)] : decide (b = true) = b",
"start": [
53,
1
],
"end": [
53,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_eq_false",
"code": "@[simp] theorem decide_eq_false {b : Bool} [Decidable (b = false)] : decide (b = false) = !b",
"start": [
54,
1
],
"end": [
54,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_true_eq",
"code": "@[simp] theorem decide_true_eq {b : Bool} [Decidable (true = b)] : decide (true = b) = b",
"start": [
55,
1
],
"end": [
55,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_false_eq",
"code": "@[simp] theorem decide_false_eq {b : Bool} [Decidable (false = b)] : decide (false = b) = !b",
"start": [
56,
1
],
"end": [
56,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_self_left",
"code": "@[simp] theorem and_self_left : ∀(a b : Bool), (a && (a && b)) = (a && b)",
"start": [
60,
1
],
"end": [
60,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_self_right",
"code": "@[simp] theorem and_self_right : ∀(a b : Bool), ((a && b) && b) = (a && b)",
"start": [
61,
1
],
"end": [
61,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_and_self",
"code": "@[simp] theorem not_and_self : ∀ (x : Bool), (!x && x) = false",
"start": [
63,
1
],
"end": [
63,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_not_self",
"code": "@[simp] theorem and_not_self : ∀ (x : Bool), (x && !x) = false",
"start": [
64,
1
],
"end": [
64,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_true_and_eq_false_self",
"code": "@[simp] theorem eq_true_and_eq_false_self : ∀(b : Bool), (b = true ∧ b = false) ↔ False",
"start": [
73,
1
],
"end": [
73,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_and_eq_true_self",
"code": "@[simp] theorem eq_false_and_eq_true_self : ∀(b : Bool), (b = false ∧ b = true) ↔ False",
"start": [
74,
1
],
"end": [
74,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_comm",
"code": "theorem and_comm : ∀ (x y : Bool), (x && y) = (y && x)",
"start": [
76,
1
],
"end": [
76,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_left_comm",
"code": "theorem and_left_comm : ∀ (x y z : Bool), (x && (y && z)) = (y && (x && z))",
"start": [
79,
1
],
"end": [
79,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_right_comm",
"code": "theorem and_right_comm : ∀ (x y z : Bool), ((x && y) && z) = ((x && z) && y)",
"start": [
80,
1
],
"end": [
80,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_iff_left_iff_imp",
"code": "@[simp] theorem and_iff_left_iff_imp : ∀(a b : Bool), ((a && b) = a) ↔ (a → b)",
"start": [
89,
1
],
"end": [
89,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_iff_right_iff_imp",
"code": "@[simp] theorem and_iff_right_iff_imp : ∀(a b : Bool), ((a && b) = b) ↔ (b → a)",
"start": [
90,
1
],
"end": [
90,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.iff_self_and",
"code": "@[simp] theorem iff_self_and : ∀(a b : Bool), (a = (a && b)) ↔ (a → b)",
"start": [
91,
1
],
"end": [
91,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.iff_and_self",
"code": "@[simp] theorem iff_and_self : ∀(a b : Bool), (b = (a && b)) ↔ (b → a)",
"start": [
92,
1
],
"end": [
92,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_self_left",
"code": "@[simp] theorem or_self_left : ∀(a b : Bool), (a || (a || b)) = (a || b)",
"start": [
96,
1
],
"end": [
96,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_self_right",
"code": "@[simp] theorem or_self_right : ∀(a b : Bool), ((a || b) || b) = (a || b)",
"start": [
97,
1
],
"end": [
97,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_or_self",
"code": "@[simp] theorem not_or_self : ∀ (x : Bool), (!x || x) = true",
"start": [
99,
1
],
"end": [
99,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_not_self",
"code": "@[simp] theorem or_not_self : ∀ (x : Bool), (x || !x) = true",
"start": [
100,
1
],
"end": [
100,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_true_or_eq_false_self",
"code": "@[simp] theorem eq_true_or_eq_false_self : ∀(b : Bool), (b = true ∨ b = false) ↔ True",
"start": [
108,
1
],
"end": [
108,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_or_eq_true_self",
"code": "@[simp] theorem eq_false_or_eq_true_self : ∀(b : Bool), (b = false ∨ b = true) ↔ True",
"start": [
109,
1
],
"end": [
109,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_iff_left_iff_imp",
"code": "@[simp] theorem or_iff_left_iff_imp : ∀(a b : Bool), ((a || b) = a) ↔ (b → a)",
"start": [
118,
1
],
"end": [
118,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_iff_right_iff_imp",
"code": "@[simp] theorem or_iff_right_iff_imp : ∀(a b : Bool), ((a || b) = b) ↔ (a → b)",
"start": [
119,
1
],
"end": [
119,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.iff_self_or",
"code": "@[simp] theorem iff_self_or : ∀(a b : Bool), (a = (a || b)) ↔ (b → a)",
"start": [
120,
1
],
"end": [
120,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.iff_or_self",
"code": "@[simp] theorem iff_or_self : ∀(a b : Bool), (b = (a || b)) ↔ (a → b)",
"start": [
121,
1
],
"end": [
121,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_comm",
"code": "theorem or_comm : ∀ (x y : Bool), (x || y) = (y || x)",
"start": [
123,
1
],
"end": [
123,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_left_comm",
"code": "theorem or_left_comm : ∀ (x y z : Bool), (x || (y || z)) = (y || (x || z))",
"start": [
126,
1
],
"end": [
126,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_right_comm",
"code": "theorem or_right_comm : ∀ (x y z : Bool), ((x || y) || z) = ((x || z) || y)",
"start": [
127,
1
],
"end": [
127,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_distrib_left",
"code": "theorem and_or_distrib_left : ∀ (x y z : Bool), (x && (y || z)) = (x && y || x && z)",
"start": [
131,
1
],
"end": [
131,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_distrib_right",
"code": "theorem and_or_distrib_right : ∀ (x y z : Bool), ((x || y) && z) = (x && z || y && z)",
"start": [
132,
1
],
"end": [
132,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_and_distrib_left",
"code": "theorem or_and_distrib_left : ∀ (x y z : Bool), (x || y && z) = ((x || y) && (x || z))",
"start": [
134,
1
],
"end": [
134,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_and_distrib_right",
"code": "theorem or_and_distrib_right : ∀ (x y z : Bool), (x && y || z) = ((x || z) && (y || z))",
"start": [
135,
1
],
"end": [
135,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_xor_distrib_left",
"code": "theorem and_xor_distrib_left : ∀ (x y z : Bool), (x && xor y z) = xor (x && y) (x && z)",
"start": [
137,
1
],
"end": [
137,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_xor_distrib_right",
"code": "theorem and_xor_distrib_right : ∀ (x y z : Bool), (xor x y && z) = xor (x && z) (y && z)",
"start": [
138,
1
],
"end": [
138,
102
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_and",
"code": "@[simp] theorem not_and : ∀ (x y : Bool), (!(x && y)) = (!x || !y)",
"start": [
140,
1
],
"end": [
141,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_or",
"code": "@[simp] theorem not_or : ∀ (x y : Bool), (!(x || y)) = (!x && !y)",
"start": [
143,
1
],
"end": [
144,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_eq_true_iff",
"code": "theorem and_eq_true_iff (x y : Bool) : (x && y) = true ↔ x = true ∧ y = true",
"start": [
146,
1
],
"end": [
147,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_eq_false_iff",
"code": "theorem and_eq_false_iff : ∀ (x y : Bool), (x && y) = false ↔ x = false ∨ y = false",
"start": [
149,
1
],
"end": [
149,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_eq_false_imp",
"code": "@[simp] theorem and_eq_false_imp : ∀ (x y : Bool), (x && y) = false ↔ (x = true → y = false)",
"start": [
164,
1
],
"end": [
164,
106
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_eq_true_iff",
"code": "@[simp] theorem or_eq_true_iff : ∀ (x y : Bool), (x || y) = true ↔ x = true ∨ y = true",
"start": [
166,
1
],
"end": [
166,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.or_eq_false_iff",
"code": "@[simp] theorem or_eq_false_iff : ∀ (x y : Bool), (x || y) = false ↔ x = false ∧ y = false",
"start": [
168,
1
],
"end": [
168,
104
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_eq_true",
"code": "@[simp] theorem false_eq_true : (false = true) = False",
"start": [
172,
1
],
"end": [
176,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_eq_false",
"code": "@[simp] theorem true_eq_false : (true = false) = False",
"start": [
177,
1
],
"end": [
177,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_eq",
"code": "@[simp low] theorem false_eq (b : Bool) : (false = b) = (b = false)",
"start": [
182,
1
],
"end": [
183,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_eq",
"code": "@[simp low] theorem true_eq (b : Bool) : (true = b) = (b = true)",
"start": [
185,
1
],
"end": [
186,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_beq",
"code": "@[simp] theorem true_beq : ∀b, (true == b) = b",
"start": [
188,
1
],
"end": [
188,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_beq",
"code": "@[simp] theorem false_beq : ∀b, (false == b) = !b",
"start": [
189,
1
],
"end": [
189,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_true",
"code": "@[simp] theorem beq_true : ∀b, (b == true) = b",
"start": [
190,
1
],
"end": [
190,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_false",
"code": "@[simp] theorem beq_false : ∀b, (b == false) = !b",
"start": [
194,
1
],
"end": [
194,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_bne",
"code": "@[simp] theorem true_bne : ∀(b : Bool), (true != b) = !b",
"start": [
196,
1
],
"end": [
196,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_bne",
"code": "@[simp] theorem false_bne : ∀(b : Bool), (false != b) = b",
"start": [
197,
1
],
"end": [
197,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_true",
"code": "@[simp] theorem bne_true : ∀(b : Bool), (b != true) = !b",
"start": [
198,
1
],
"end": [
198,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_false",
"code": "@[simp] theorem bne_false : ∀(b : Bool), (b != false) = b",
"start": [
199,
1
],
"end": [
199,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_beq_self",
"code": "@[simp] theorem not_beq_self : ∀ (x : Bool), ((!x) == x) = false",
"start": [
204,
1
],
"end": [
204,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_not_self",
"code": "@[simp] theorem beq_not_self : ∀ (x : Bool), (x == !x) = false",
"start": [
205,
1
],
"end": [
205,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_bne_self",
"code": "@[simp] theorem not_bne_self : ∀ (x : Bool), ((!x) != x) = true",
"start": [
207,
1
],
"end": [
207,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_not_self",
"code": "@[simp] theorem bne_not_self : ∀ (x : Bool), (x != !x) = true",
"start": [
208,
1
],
"end": [
208,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_self",
"code": "@[simp] theorem not_eq_self : ∀(b : Bool), ((!b) = b) ↔ False",
"start": [
214,
1
],
"end": [
214,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_not_self",
"code": "@[simp] theorem eq_not_self : ∀(b : Bool), (b = (!b)) ↔ False",
"start": [
215,
1
],
"end": [
215,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_self_left",
"code": "@[simp] theorem beq_self_left : ∀(a b : Bool), (a == (a == b)) = b",
"start": [
217,
1
],
"end": [
217,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_self_right",
"code": "@[simp] theorem beq_self_right : ∀(a b : Bool), ((a == b) == b) = a",
"start": [
218,
1
],
"end": [
218,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_self_left",
"code": "@[simp] theorem bne_self_left : ∀(a b : Bool), (a != (a != b)) = b",
"start": [
219,
1
],
"end": [
219,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_self_right",
"code": "@[simp] theorem bne_self_right : ∀(a b : Bool), ((a != b) != b) = a",
"start": [
220,
1
],
"end": [
220,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_bne_not",
"code": "@[simp] theorem not_bne_not : ∀ (x y : Bool), ((!x) != (!y)) = (x != y)",
"start": [
222,
1
],
"end": [
222,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_assoc",
"code": "@[simp] theorem bne_assoc : ∀ (x y z : Bool), ((x != y) != z) = (x != (y != z))",
"start": [
224,
1
],
"end": [
224,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_left_inj",
"code": "@[simp] theorem bne_left_inj : ∀ (x y z : Bool), (x != y) = (x != z) ↔ y = z",
"start": [
227,
1
],
"end": [
227,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.bne_right_inj",
"code": "@[simp] theorem bne_right_inj : ∀ (x y z : Bool), (x != z) = (y != z) ↔ x = y",
"start": [
228,
1
],
"end": [
228,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_not_of_ne",
"code": "theorem eq_not_of_ne : ∀ {x y : Bool}, x ≠ y → x = !y",
"start": [
230,
1
],
"end": [
230,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_eq_decide_eq",
"code": "theorem beq_eq_decide_eq [BEq α] [LawfulBEq α] [DecidableEq α] (a b : α) :\n (a == b) = decide (a = b)",
"start": [
234,
1
],
"end": [
238,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_eq_not",
"code": "@[simp] theorem not_eq_not : ∀ {a b : Bool}, ¬a = !b ↔ a = b",
"start": [
240,
1
],
"end": [
240,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_not_eq",
"code": "@[simp] theorem not_not_eq : ∀ {a b : Bool}, ¬(!a) = b ↔ a = b",
"start": [
242,
1
],
"end": [
242,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.coe_iff_coe",
"code": "@[simp] theorem coe_iff_coe : ∀(a b : Bool), (a ↔ b) ↔ a = b",
"start": [
244,
1
],
"end": [
244,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.coe_true_iff_false",
"code": "@[simp] theorem coe_true_iff_false : ∀(a b : Bool), (a ↔ b = false) ↔ a = (!b)",
"start": [
246,
1
],
"end": [
246,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.coe_false_iff_true",
"code": "@[simp] theorem coe_false_iff_true : ∀(a b : Bool), (a = false ↔ b) ↔ (!a) = b",
"start": [
247,
1
],
"end": [
247,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.coe_false_iff_false",
"code": "@[simp] theorem coe_false_iff_false : ∀(a b : Bool), (a = false ↔ b = false) ↔ (!a) = (!b)",
"start": [
248,
1
],
"end": [
248,
104
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.beq_comm",
"code": "theorem beq_comm {α} [BEq α] [LawfulBEq α] {a b : α} : (a == b) = (b == a)",
"start": [
252,
1
],
"end": [
253,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_xor",
"code": "theorem false_xor : ∀ (x : Bool), xor false x = x",
"start": [
257,
1
],
"end": [
257,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_false",
"code": "theorem xor_false : ∀ (x : Bool), xor x false = x",
"start": [
259,
1
],
"end": [
259,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.true_xor",
"code": "theorem true_xor : ∀ (x : Bool), xor true x = !x",
"start": [
261,
1
],
"end": [
261,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_true",
"code": "theorem xor_true : ∀ (x : Bool), xor x true = !x",
"start": [
263,
1
],
"end": [
263,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_xor_self",
"code": "theorem not_xor_self : ∀ (x : Bool), xor (!x) x = true",
"start": [
265,
1
],
"end": [
265,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_not_self",
"code": "theorem xor_not_self : ∀ (x : Bool), xor x (!x) = true",
"start": [
267,
1
],
"end": [
267,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_xor",
"code": "theorem not_xor : ∀ (x y : Bool), xor (!x) y = !(xor x y)",
"start": [
269,
1
],
"end": [
269,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_not",
"code": "theorem xor_not : ∀ (x y : Bool), xor x (!y) = !(xor x y)",
"start": [
271,
1
],
"end": [
271,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_xor_not",
"code": "theorem not_xor_not : ∀ (x y : Bool), xor (!x) (!y) = (xor x y)",
"start": [
273,
1
],
"end": [
273,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_self",
"code": "theorem xor_self : ∀ (x : Bool), xor x x = false",
"start": [
275,
1
],
"end": [
275,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_comm",
"code": "theorem xor_comm : ∀ (x y : Bool), xor x y = xor y x",
"start": [
277,
1
],
"end": [
277,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_left_comm",
"code": "theorem xor_left_comm : ∀ (x y z : Bool), xor x (xor y z) = xor y (xor x z)",
"start": [
279,
1
],
"end": [
279,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_right_comm",
"code": "theorem xor_right_comm : ∀ (x y z : Bool), xor (xor x y) z = xor (xor x z) y",
"start": [
281,
1
],
"end": [
281,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_assoc",
"code": "theorem xor_assoc : ∀ (x y z : Bool), xor (xor x y) z = xor x (xor y z)",
"start": [
283,
1
],
"end": [
283,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_left_inj",
"code": "theorem xor_left_inj : ∀ (x y z : Bool), xor x y = xor x z ↔ y = z",
"start": [
285,
1
],
"end": [
285,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.xor_right_inj",
"code": "theorem xor_right_inj : ∀ (x y z : Bool), xor x z = xor y z ↔ x = y",
"start": [
287,
1
],
"end": [
287,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_true",
"code": "@[simp] protected theorem le_true : ∀ (x : Bool), x ≤ true",
"start": [
291,
1
],
"end": [
291,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.false_le",
"code": "@[simp] protected theorem false_le : ∀ (x : Bool), false ≤ x",
"start": [
293,
1
],
"end": [
293,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_refl",
"code": "@[simp] protected theorem le_refl : ∀ (x : Bool), x ≤ x",
"start": [
295,
1
],
"end": [
295,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl : ∀ (x : Bool), ¬ x < x",
"start": [
297,
1
],
"end": [
297,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_trans",
"code": "protected theorem le_trans : ∀ {x y z : Bool}, x ≤ y → y ≤ z → x ≤ z",
"start": [
299,
1
],
"end": [
299,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_antisymm",
"code": "protected theorem le_antisymm : ∀ {x y : Bool}, x ≤ y → y ≤ x → x = y",
"start": [
301,
1
],
"end": [
301,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_total",
"code": "protected theorem le_total : ∀ (x y : Bool), x ≤ y ∨ y ≤ x",
"start": [
303,
1
],
"end": [
303,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_asymm",
"code": "protected theorem lt_asymm : ∀ {x y : Bool}, x < y → ¬ y < x",
"start": [
305,
1
],
"end": [
305,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_trans",
"code": "protected theorem lt_trans : ∀ {x y z : Bool}, x < y → y < z → x < z",
"start": [
307,
1
],
"end": [
307,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_iff_le_not_le",
"code": "protected theorem lt_iff_le_not_le : ∀ {x y : Bool}, x < y ↔ x ≤ y ∧ ¬ y ≤ x",
"start": [
309,
1
],
"end": [
309,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_of_le_of_lt",
"code": "protected theorem lt_of_le_of_lt : ∀ {x y z : Bool}, x ≤ y → y < z → x < z",
"start": [
311,
1
],
"end": [
311,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_of_lt_of_le",
"code": "protected theorem lt_of_lt_of_le : ∀ {x y z : Bool}, x < y → y ≤ z → x < z",
"start": [
313,
1
],
"end": [
313,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_of_lt",
"code": "protected theorem le_of_lt : ∀ {x y : Bool}, x < y → x ≤ y",
"start": [
315,
1
],
"end": [
315,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_of_eq",
"code": "protected theorem le_of_eq : ∀ {x y : Bool}, x = y → x ≤ y",
"start": [
317,
1
],
"end": [
317,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.ne_of_lt",
"code": "protected theorem ne_of_lt : ∀ {x y : Bool}, x < y → x ≠ y",
"start": [
319,
1
],
"end": [
319,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.lt_of_le_of_ne",
"code": "protected theorem lt_of_le_of_ne : ∀ {x y : Bool}, x ≤ y → x ≠ y → x < y",
"start": [
321,
1
],
"end": [
321,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.le_of_lt_or_eq",
"code": "protected theorem le_of_lt_or_eq : ∀ {x y : Bool}, x < y ∨ x = y → x ≤ y",
"start": [
323,
1
],
"end": [
323,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_true_of_true_le",
"code": "protected theorem eq_true_of_true_le : ∀ {x : Bool}, true ≤ x → x = true",
"start": [
325,
1
],
"end": [
325,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_of_le_false",
"code": "protected theorem eq_false_of_le_false : ∀ {x : Bool}, x ≤ false → x = false",
"start": [
327,
1
],
"end": [
327,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.max_eq_or",
"code": "@[simp] protected theorem max_eq_or : max = or",
"start": [
331,
1
],
"end": [
331,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.min_eq_and",
"code": "@[simp] protected theorem min_eq_and : min = and",
"start": [
333,
1
],
"end": [
333,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_inj",
"code": "theorem not_inj : ∀ {x y : Bool}, (!x) = (!y) → x = y",
"start": [
337,
1
],
"end": [
337,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_inj_iff",
"code": "theorem not_inj_iff : ∀ {x y : Bool}, (!x) = (!y) ↔ x = y",
"start": [
339,
1
],
"end": [
339,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_inj_right",
"code": "theorem and_or_inj_right : ∀ {m x y : Bool}, (x && m) = (y && m) → (x || m) = (y || m) → x = y",
"start": [
341,
1
],
"end": [
342,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_inj_right_iff",
"code": "theorem and_or_inj_right_iff :\n ∀ {m x y : Bool}, (x && m) = (y && m) ∧ (x || m) = (y || m) ↔ x = y",
"start": [
344,
1
],
"end": [
345,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_inj_left",
"code": "theorem and_or_inj_left : ∀ {m x y : Bool}, (m && x) = (m && y) → (m || x) = (m || y) → x = y",
"start": [
347,
1
],
"end": [
348,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.and_or_inj_left_iff",
"code": "theorem and_or_inj_left_iff :\n ∀ {m x y : Bool}, (m && x) = (m && y) ∧ (m || x) = (m || y) ↔ x = y",
"start": [
350,
1
],
"end": [
351,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat",
"code": "def toNat (b:Bool) : Nat := cond b 1 0",
"start": [
355,
1
],
"end": [
356,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_false",
"code": "@[simp] theorem toNat_false : false.toNat = 0",
"start": [
358,
1
],
"end": [
358,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_true",
"code": "@[simp] theorem toNat_true : true.toNat = 1",
"start": [
360,
1
],
"end": [
360,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_le",
"code": "theorem toNat_le (c : Bool) : c.toNat ≤ 1",
"start": [
362,
1
],
"end": [
363,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_le_one",
"code": "@[deprecated toNat_le (since := \"2024-02-23\")]\nabbrev toNat_le_one := toNat_le",
"start": [
365,
1
],
"end": [
366,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_lt",
"code": "theorem toNat_lt (b : Bool) : b.toNat < 2",
"start": [
368,
1
],
"end": [
369,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_eq_zero",
"code": "@[simp] theorem toNat_eq_zero (b : Bool) : b.toNat = 0 ↔ b = false",
"start": [
371,
1
],
"end": [
372,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.toNat_eq_one",
"code": "@[simp] theorem toNat_eq_one (b : Bool) : b.toNat = 1 ↔ b = true",
"start": [
373,
1
],
"end": [
374,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.if_true_left",
"code": "@[simp] theorem if_true_left (p : Prop) [h : Decidable p] (f : Bool) :\n (ite p true f) = (p || f)",
"start": [
378,
1
],
"end": [
379,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.if_false_left",
"code": "@[simp] theorem if_false_left (p : Prop) [h : Decidable p] (f : Bool) :\n (ite p false f) = (!p && f)",
"start": [
381,
1
],
"end": [
382,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.if_true_right",
"code": "@[simp] theorem if_true_right (p : Prop) [h : Decidable p] (t : Bool) :\n (ite p t true) = (!(p : Bool) || t)",
"start": [
384,
1
],
"end": [
385,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.if_false_right",
"code": "@[simp] theorem if_false_right (p : Prop) [h : Decidable p] (t : Bool) :\n (ite p t false) = (p && t)",
"start": [
387,
1
],
"end": [
388,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.ite_eq_true_distrib",
"code": "@[simp] theorem ite_eq_true_distrib (p : Prop) [h : Decidable p] (t f : Bool) :\n (ite p t f = true) = ite p (t = true) (f = true)",
"start": [
390,
1
],
"end": [
392,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.ite_eq_false_distrib",
"code": "@[simp] theorem ite_eq_false_distrib (p : Prop) [h : Decidable p] (t f : Bool) :\n (ite p t f = false) = ite p (t = false) (f = false)",
"start": [
394,
1
],
"end": [
396,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_ite_eq_true_eq_true",
"code": "@[simp]\ntheorem not_ite_eq_true_eq_true (p : Prop) [h : Decidable p] (b c : Bool) :\n ¬(ite p (b = true) (c = true)) ↔ (ite p (b = false) (c = false))",
"start": [
411,
1
],
"end": [
414,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_ite_eq_false_eq_false",
"code": "@[simp]\ntheorem not_ite_eq_false_eq_false (p : Prop) [h : Decidable p] (b c : Bool) :\n ¬(ite p (b = false) (c = false)) ↔ (ite p (b = true) (c = true))",
"start": [
416,
1
],
"end": [
419,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_ite_eq_true_eq_false",
"code": "@[simp]\ntheorem not_ite_eq_true_eq_false (p : Prop) [h : Decidable p] (b c : Bool) :\n ¬(ite p (b = true) (c = false)) ↔ (ite p (b = false) (c = true))",
"start": [
421,
1
],
"end": [
424,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.not_ite_eq_false_eq_true",
"code": "@[simp]\ntheorem not_ite_eq_false_eq_true (p : Prop) [h : Decidable p] (b c : Bool) :\n ¬(ite p (b = false) (c = true)) ↔ (ite p (b = true) (c = false))",
"start": [
426,
1
],
"end": [
429,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_false_imp_eq_true",
"code": "@[simp] theorem eq_false_imp_eq_true : ∀(b:Bool), (b = false → b = true) ↔ (b = true)",
"start": [
435,
1
],
"end": [
435,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.eq_true_imp_eq_false",
"code": "@[simp] theorem eq_true_imp_eq_false : ∀(b:Bool), (b = true → b = false) ↔ (b = false)",
"start": [
441,
1
],
"end": [
441,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_eq_ite",
"code": "theorem cond_eq_ite {α} (b : Bool) (t e : α) : cond b t e = if b then t else e",
"start": [
446,
1
],
"end": [
447,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_eq_if",
"code": "theorem cond_eq_if : (bif b then x else y) = (if b then x else y)",
"start": [
449,
1
],
"end": [
449,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_not",
"code": "@[simp] theorem cond_not (b : Bool) (t e : α) : cond (!b) t e = cond b e t",
"start": [
451,
1
],
"end": [
452,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_self",
"code": "@[simp] theorem cond_self (c : Bool) (t : α) : cond c t t = t",
"start": [
454,
1
],
"end": [
454,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_decide",
"code": "theorem cond_decide {α} (p : Prop) [Decidable p] (t e : α) :\n cond (decide p) t e = if p then t else e",
"start": [
469,
1
],
"end": [
471,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_eq_ite_iff",
"code": "@[simp] theorem cond_eq_ite_iff (a : Bool) (p : Prop) [h : Decidable p] (x y u v : α) :\n (cond a x y = ite p u v) ↔ ite a x y = ite p u v",
"start": [
473,
1
],
"end": [
475,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.ite_eq_cond_iff",
"code": "@[simp] theorem ite_eq_cond_iff (p : Prop) [h : Decidable p] (a : Bool) (x y u v : α) :\n (ite p x y = cond a u v) ↔ ite p x y = ite a u v",
"start": [
477,
1
],
"end": [
479,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_eq_true_distrib",
"code": "@[simp] theorem cond_eq_true_distrib : ∀(c t f : Bool),\n (cond c t f = true) = ite (c = true) (t = true) (f = true)",
"start": [
481,
1
],
"end": [
483,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_eq_false_distrib",
"code": "@[simp] theorem cond_eq_false_distrib : ∀(c t f : Bool),\n (cond c t f = false) = ite (c = true) (t = false) (f = false)",
"start": [
485,
1
],
"end": [
486,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_true",
"code": "protected theorem cond_true {α : Type u} {a b : α} : cond true a b = a",
"start": [
488,
1
],
"end": [
488,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_false",
"code": "protected theorem cond_false {α : Type u} {a b : α} : cond false a b = b",
"start": [
489,
1
],
"end": [
489,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_true_left",
"code": "@[simp] theorem cond_true_left : ∀(c f : Bool), cond c true f = ( c || f)",
"start": [
491,
1
],
"end": [
491,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_false_left",
"code": "@[simp] theorem cond_false_left : ∀(c f : Bool), cond c false f = (!c && f)",
"start": [
492,
1
],
"end": [
492,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_true_right",
"code": "@[simp] theorem cond_true_right : ∀(c t : Bool), cond c t true = (!c || t)",
"start": [
493,
1
],
"end": [
493,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_false_right",
"code": "@[simp] theorem cond_false_right : ∀(c t : Bool), cond c t false = ( c && t)",
"start": [
494,
1
],
"end": [
494,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_true_same",
"code": "@[simp] theorem cond_true_same : ∀(c b : Bool), cond c c b = (c || b)",
"start": [
496,
1
],
"end": [
496,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.cond_false_same",
"code": "@[simp] theorem cond_false_same : ∀(c b : Bool), cond c b c = (c && b)",
"start": [
497,
1
],
"end": [
497,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_coe",
"code": "protected theorem decide_coe (b : Bool) [Decidable (b = true)] : decide (b = true) = b",
"start": [
501,
1
],
"end": [
501,
105
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_and",
"code": "@[simp] theorem decide_and (p q : Prop) [dpq : Decidable (p ∧ q)] [dp : Decidable p] [dq : Decidable q] :\n decide (p ∧ q) = (p && q)",
"start": [
503,
1
],
"end": [
505,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_or",
"code": "@[simp] theorem decide_or (p q : Prop) [dpq : Decidable (p ∨ q)] [dp : Decidable p] [dq : Decidable q] :\n decide (p ∨ q) = (p || q)",
"start": [
507,
1
],
"end": [
509,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Bool.decide_iff_dist",
"code": "@[simp] theorem decide_iff_dist (p q : Prop) [dpq : Decidable (p ↔ q)] [dp : Decidable p] [dq : Decidable q] :\n decide (p ↔ q) = (decide p == decide q)",
"start": [
511,
1
],
"end": [
513,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "false_eq_decide_iff",
"code": "@[simp] theorem false_eq_decide_iff {p : Prop} [h : Decidable p] : false = decide p ↔ ¬p",
"start": [
521,
1
],
"end": [
522,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "true_eq_decide_iff",
"code": "@[simp] theorem true_eq_decide_iff {p : Prop} [h : Decidable p] : true = decide p ↔ p",
"start": [
524,
1
],
"end": [
525,
33
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/List/Control.lean | [
".lake/packages/lean4/src/lean/Init/Data/List/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean"
] | [
{
"full_name": "List.mapM",
"code": "@[inline]\ndef mapM {m : Type u → Type v} [Monad m] {α : Type w} {β : Type u} (f : α → m β) (as : List α) : m (List β) :=\n let rec @[specialize] loop\n | [], bs => pure bs.reverse\n | a :: as, bs => do loop as ((← f a)::bs)\n loop as []",
"start": [
43,
1
],
"end": [
55,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapA",
"code": "@[specialize]\ndef mapA {m : Type u → Type v} [Applicative m] {α : Type w} {β : Type u} (f : α → m β) : List α → m (List β)\n | [] => pure []\n | a::as => List.cons <$> f a <*> mapA f as",
"start": [
57,
1
],
"end": [
71,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forM",
"code": "@[specialize]\nprotected def forM {m : Type u → Type v} [Monad m] {α : Type w} (as : List α) (f : α → m PUnit) : m PUnit :=\n match as with\n | [] => pure ⟨⟩\n | a :: as => do f a; List.forM as f",
"start": [
73,
1
],
"end": [
83,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forA",
"code": "@[specialize]\ndef forA {m : Type u → Type v} [Applicative m] {α : Type w} (as : List α) (f : α → m PUnit) : m PUnit :=\n match as with\n | [] => pure ⟨⟩\n | a :: as => f a *> forA as f",
"start": [
85,
1
],
"end": [
97,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterAuxM",
"code": "@[specialize]\ndef filterAuxM {m : Type → Type v} [Monad m] {α : Type} (f : α → m Bool) : List α → List α → m (List α)\n | [], acc => pure acc\n | h :: t, acc => do\n let b ← f h\n filterAuxM f t (cond b (h :: acc) acc)",
"start": [
99,
1
],
"end": [
104,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterM",
"code": "@[inline]\ndef filterM {m : Type → Type v} [Monad m] {α : Type} (p : α → m Bool) (as : List α) : m (List α) := do\n let as ← filterAuxM p as []\n pure as.reverse",
"start": [
106,
1
],
"end": [
113,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterRevM",
"code": "@[inline]\ndef filterRevM {m : Type → Type v} [Monad m] {α : Type} (p : α → m Bool) (as : List α) : m (List α) :=\n filterAuxM p as.reverse []",
"start": [
115,
1
],
"end": [
121,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMapM",
"code": "@[inline]\ndef filterMapM {m : Type u → Type v} [Monad m] {α β : Type u} (f : α → m (Option β)) (as : List α) : m (List β) :=\n let rec @[specialize] loop\n | [], bs => pure bs\n | a :: as, bs => do\n match (← f a) with\n | none => loop as bs\n | some b => loop as (b::bs)\n loop as.reverse []",
"start": [
123,
1
],
"end": [
135,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldlM",
"code": "@[specialize]\nprotected def foldlM {m : Type u → Type v} [Monad m] {s : Type u} {α : Type w} : (f : s → α → m s) → (init : s) → List α → m s\n | _, s, [] => pure s\n | f, s, a :: as => do\n let s' ← f s a\n List.foldlM f s' as",
"start": [
137,
1
],
"end": [
152,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldlM_nil",
"code": "@[simp] theorem foldlM_nil [Monad m] (f : β → α → m β) (b) : [].foldlM f b = pure b",
"start": [
154,
1
],
"end": [
154,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldlM_cons",
"code": "@[simp] theorem foldlM_cons [Monad m] (f : β → α → m β) (b) (a) (l : List α) :\n (a :: l).foldlM f b = f b a >>= l.foldlM f",
"start": [
155,
1
],
"end": [
157,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldrM",
"code": "@[inline]\ndef foldrM {m : Type u → Type v} [Monad m] {s : Type u} {α : Type w} (f : α → s → m s) (init : s) (l : List α) : m s :=\n l.reverse.foldlM (fun s a => f a s) init",
"start": [
159,
1
],
"end": [
171,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldrM_nil",
"code": "@[simp] theorem foldrM_nil [Monad m] (f : α → β → m β) (b) : [].foldrM f b = pure b",
"start": [
173,
1
],
"end": [
173,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.firstM",
"code": "@[specialize]\ndef firstM {m : Type u → Type v} [Alternative m] {α : Type w} {β : Type u} (f : α → m β) : List α → m β\n | [] => failure\n | a::as => f a <|> firstM f as",
"start": [
175,
1
],
"end": [
184,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.anyM",
"code": "@[specialize]\ndef anyM {m : Type → Type u} [Monad m] {α : Type v} (f : α → m Bool) : List α → m Bool\n | [] => pure false\n | a::as => do\n match (← f a) with\n | true => pure true\n | false => anyM f as",
"start": [
186,
1
],
"end": [
192,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.allM",
"code": "@[specialize]\ndef allM {m : Type → Type u} [Monad m] {α : Type v} (f : α → m Bool) : List α → m Bool\n | [] => pure true\n | a::as => do\n match (← f a) with\n | true => allM f as\n | false => pure false",
"start": [
194,
1
],
"end": [
200,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findM?",
"code": "@[specialize]\ndef findM? {m : Type → Type u} [Monad m] {α : Type} (p : α → m Bool) : List α → m (Option α)\n | [] => pure none\n | a::as => do\n match (← p a) with\n | true => pure (some a)\n | false => findM? p as",
"start": [
202,
1
],
"end": [
208,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSomeM?",
"code": "@[specialize]\ndef findSomeM? {m : Type u → Type v} [Monad m] {α : Type w} {β : Type u} (f : α → m (Option β)) : List α → m (Option β)\n | [] => pure none\n | a::as => do\n match (← f a) with\n | some b => pure (some b)\n | none => findSomeM? f as",
"start": [
210,
1
],
"end": [
216,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forIn",
"code": "@[inline] protected def forIn {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : List α) (init : β) (f : α → β → m (ForInStep β)) : m β :=\n let rec @[specialize] loop\n | [], b => pure b\n | a::as, b => do\n match (← f a b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop as b\n loop as init",
"start": [
218,
1
],
"end": [
225,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forIn_nil",
"code": "@[simp] theorem forIn_nil [Monad m] (f : α → β → m (ForInStep β)) (b : β) : forIn [] b f = pure b",
"start": [
230,
1
],
"end": [
231,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forIn_cons",
"code": "@[simp] theorem forIn_cons [Monad m] (f : α → β → m (ForInStep β)) (a : α) (as : List α) (b : β)\n : forIn (a::as) b f = f a b >>= fun | ForInStep.done b => pure b | ForInStep.yield b => forIn as b f",
"start": [
233,
1
],
"end": [
235,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forIn'",
"code": "@[inline] protected def forIn' {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : List α) (init : β) (f : (a : α) → a ∈ as → β → m (ForInStep β)) : m β :=\n let rec @[specialize] loop : (as' : List α) → (b : β) → Exists (fun bs => bs ++ as' = as) → m β\n | [], b, _ => pure b\n | a::as', b, h => do\n have : a ∈ as := by\n have ⟨bs, h⟩ := h\n subst h\n exact mem_append_of_mem_right _ (Mem.head ..)\n match (← f a this b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b =>\n have : Exists (fun bs => bs ++ as' = as) := have ⟨bs, h⟩ := h; ⟨bs ++ [a], by rw [← h, append_cons bs a as']⟩\n loop as' b this\n loop as init ⟨[], rfl⟩",
"start": [
237,
1
],
"end": [
250,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forIn'_eq_forIn",
"code": "@[simp] theorem forIn'_eq_forIn {α : Type u} {β : Type v} {m : Type v → Type w} [Monad m] (as : List α) (init : β) (f : α → β → m (ForInStep β)) : forIn' as init (fun a _ b => f a b) = forIn as init f",
"start": [
255,
1
],
"end": [
262,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forM_nil",
"code": "@[simp] theorem forM_nil [Monad m] (f : α → m PUnit) : forM [] f = pure ⟨⟩",
"start": [
267,
1
],
"end": [
268,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forM_cons",
"code": "@[simp] theorem forM_cons [Monad m] (f : α → m PUnit) (a : α) (as : List α) : forM (a::as) f = f a >>= fun _ => forM as f",
"start": [
269,
1
],
"end": [
270,
6
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/List/BasicAux.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean"
] | [
{
"full_name": "List.get!",
"code": "def get! [Inhabited α] : (as : List α) → (i : Nat) → α\n | a::_, 0 => a\n | _::as, n+1 => get! as n\n | _, _ => panic! \"invalid index\"",
"start": [
19,
1
],
"end": [
28,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_nil",
"code": "theorem get!_nil [Inhabited α] (n : Nat) : [].get! n = (default : α)",
"start": [
30,
1
],
"end": [
30,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_cons_succ",
"code": "theorem get!_cons_succ [Inhabited α] (l : List α) (a : α) (n : Nat) :\n (a::l).get! (n+1) = get! l n",
"start": [
31,
1
],
"end": [
32,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_cons_zero",
"code": "theorem get!_cons_zero [Inhabited α] (l : List α) (a : α) : (a::l).get! 0 = a",
"start": [
33,
1
],
"end": [
33,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast!",
"code": "def getLast! [Inhabited α] : List α → α\n | [] => panic! \"empty list\"\n | a::as => getLast (a::as) (fun h => List.noConfusion h)",
"start": [
37,
1
],
"end": [
45,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head!",
"code": "def head! [Inhabited α] : List α → α\n | [] => panic! \"empty list\"\n | a::_ => a",
"start": [
51,
1
],
"end": [
59,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail!",
"code": "def tail! : List α → List α\n | [] => panic! \"empty list\"\n | _::as => as",
"start": [
63,
1
],
"end": [
71,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail!_cons",
"code": "@[simp] theorem tail!_cons : @tail! α (a::l) = l",
"start": [
73,
1
],
"end": [
73,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.partitionM",
"code": "@[inline] def partitionM [Monad m] (p : α → m Bool) (l : List α) : m (List α × List α) :=\n go l #[] #[]\nwhere\n \n @[specialize] go : List α → Array α → Array α → m (List α × List α)\n | [], acc₁, acc₂ => pure (acc₁.toList, acc₂.toList)\n | x :: xs, acc₁, acc₂ => do\n if ← p x then\n go xs (acc₁.push x) acc₂\n else\n go xs acc₁ (acc₂.push x)",
"start": [
77,
1
],
"end": [
103,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.partitionMap",
"code": "@[inline] def partitionMap (f : α → β ⊕ γ) (l : List α) : List β × List γ := go l #[] #[] where\n \n @[specialize] go : List α → Array β → Array γ → List β × List γ\n | [], acc₁, acc₂ => (acc₁.toList, acc₂.toList)\n | x :: xs, acc₁, acc₂ =>\n match f x with\n | .inl a => go xs (acc₁.push a) acc₂\n | .inr b => go xs acc₁ (acc₂.push b)",
"start": [
107,
1
],
"end": [
124,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapMonoMImp",
"code": "@[specialize] private unsafe def mapMonoMImp [Monad m] (as : List α) (f : α → m α) : m (List α) := do\n match as with\n | [] => return as\n | b :: bs =>\n let b' ← f b\n let bs' ← mapMonoMImp bs f\n if ptrEq b' b && ptrEq bs' bs then\n return as\n else\n return b' :: bs'",
"start": [
133,
1
],
"end": [
142,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapMonoM",
"code": "@[implemented_by mapMonoMImp] def mapMonoM [Monad m] (as : List α) (f : α → m α) : m (List α) :=\n match as with\n | [] => return []\n | a :: as => return (← f a) :: (← mapMonoM as f)",
"start": [
144,
1
],
"end": [
151,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapMono",
"code": "def mapMono (as : List α) (f : α → α) : List α :=\n Id.run <| as.mapMonoM f",
"start": [
153,
1
],
"end": [
154,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_append_left",
"code": "theorem getElem_append_left (as bs : List α) (h : i < as.length) {h'} : (as ++ bs)[i] = as[i]",
"start": [
158,
1
],
"end": [
164,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_append_right",
"code": "theorem getElem_append_right (as bs : List α) (h : ¬ i < as.length) {h' h''} : (as ++ bs)[i]'h' = bs[i - as.length]'h''",
"start": [
166,
1
],
"end": [
171,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_last",
"code": "theorem get_last {as : List α} {i : Fin (length (as ++ [a]))} (h : ¬ i.1 < as.length) : (as ++ [a] : List _).get i = a",
"start": [
173,
1
],
"end": [
181,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.sizeOf_lt_of_mem",
"code": "theorem sizeOf_lt_of_mem [SizeOf α] {as : List α} (h : a ∈ as) : sizeOf a < sizeOf as",
"start": [
183,
1
],
"end": [
186,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_cancel_left",
"code": "theorem append_cancel_left {as bs cs : List α} (h : as ++ bs = as ++ cs) : bs = cs",
"start": [
201,
1
],
"end": [
206,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_cancel_right",
"code": "theorem append_cancel_right {as bs cs : List α} (h : as ++ bs = cs ++ bs) : as = cs",
"start": [
208,
1
],
"end": [
213,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_cancel_left_eq",
"code": "@[simp] theorem append_cancel_left_eq (as bs cs : List α) : (as ++ bs = as ++ cs) = (bs = cs)",
"start": [
215,
1
],
"end": [
218,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_cancel_right_eq",
"code": "@[simp] theorem append_cancel_right_eq (as bs cs : List α) : (as ++ bs = cs ++ bs) = (as = cs)",
"start": [
220,
1
],
"end": [
223,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.sizeOf_get",
"code": "@[simp] theorem sizeOf_get [SizeOf α] (as : List α) (i : Fin as.length) : sizeOf (as.get i) < sizeOf as",
"start": [
225,
1
],
"end": [
231,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "List.le_antisymm",
"code": "theorem le_antisymm [LT α] [s : Antisymm (¬ · < · : α → α → Prop)] {as bs : List α} (h₁ : as ≤ bs) (h₂ : bs ≤ as) : as = bs",
"start": [
233,
1
],
"end": [
247,
24
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Option/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Classical.lean",
".lake/packages/lean4/src/lean/Init/Ext.lean",
".lake/packages/lean4/src/lean/Init/Data/Option/Instances.lean"
] | [
{
"full_name": "Option.mem_iff",
"code": "theorem mem_iff {a : α} {b : Option α} : a ∈ b ↔ b = a",
"start": [
13,
1
],
"end": [
13,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.some_ne_none",
"code": "theorem some_ne_none (x : α) : some x ≠ none",
"start": [
15,
1
],
"end": [
15,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.forall",
"code": "protected theorem «forall» {p : Option α → Prop} : (∀ x, p x) ↔ p none ∧ ∀ x, p (some x)",
"start": [
17,
1
],
"end": [
18,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.exists",
"code": "protected theorem «exists» {p : Option α → Prop} :\n (∃ x, p x) ↔ p none ∨ ∃ x, p (some x)",
"start": [
20,
1
],
"end": [
23,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.get_mem",
"code": "theorem get_mem : ∀ {o : Option α} (h : isSome o), o.get h ∈ o",
"start": [
25,
1
],
"end": [
26,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.get_of_mem",
"code": "theorem get_of_mem : ∀ {o : Option α} (h : isSome o), a ∈ o → o.get h = a",
"start": [
28,
1
],
"end": [
29,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.not_mem_none",
"code": "theorem not_mem_none (a : α) : a ∉ (none : Option α)",
"start": [
31,
1
],
"end": [
31,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.some_get",
"code": "@[simp] theorem some_get : ∀ {x : Option α} (h : isSome x), some (x.get h) = x",
"start": [
33,
1
],
"end": [
34,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.get_some",
"code": "@[simp] theorem get_some (x : α) (h : isSome (some x)) : (some x).get h = x",
"start": [
36,
1
],
"end": [
36,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD_of_ne_none",
"code": "theorem getD_of_ne_none {x : Option α} (hx : x ≠ none) (y : α) : some (x.getD y) = x",
"start": [
38,
1
],
"end": [
39,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD_eq_iff",
"code": "theorem getD_eq_iff {o : Option α} {a b} : o.getD a = b ↔ (o = some b ∨ o = none ∧ a = b)",
"start": [
41,
1
],
"end": [
42,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mem_unique",
"code": "theorem mem_unique {o : Option α} {a b : α} (ha : a ∈ o) (hb : b ∈ o) : a = b",
"start": [
44,
1
],
"end": [
45,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.ext",
"code": "@[ext] theorem ext : ∀ {o₁ o₂ : Option α}, (∀ a, a ∈ o₁ ↔ a ∈ o₂) → o₁ = o₂",
"start": [
47,
1
],
"end": [
50,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.eq_none_iff_forall_not_mem",
"code": "theorem eq_none_iff_forall_not_mem : o = none ↔ ∀ a, a ∉ o",
"start": [
52,
1
],
"end": [
53,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isSome_none",
"code": "@[simp] theorem isSome_none : @isSome α none = false",
"start": [
55,
1
],
"end": [
55,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isSome_some",
"code": "@[simp] theorem isSome_some : isSome (some a) = true",
"start": [
57,
1
],
"end": [
57,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isSome_iff_exists",
"code": "theorem isSome_iff_exists : isSome x ↔ ∃ a, x = some a",
"start": [
59,
1
],
"end": [
59,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isNone_none",
"code": "@[simp] theorem isNone_none : @isNone α none = true",
"start": [
61,
1
],
"end": [
61,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.isNone_some",
"code": "@[simp] theorem isNone_some : isNone (some a) = false",
"start": [
63,
1
],
"end": [
63,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.not_isSome",
"code": "@[simp] theorem not_isSome : isSome a = false ↔ a.isNone = true",
"start": [
65,
1
],
"end": [
66,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.eq_some_iff_get_eq",
"code": "theorem eq_some_iff_get_eq : o = some a ↔ ∃ h : o.isSome, o.get h = a",
"start": [
68,
1
],
"end": [
69,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.eq_some_of_isSome",
"code": "theorem eq_some_of_isSome : ∀ {o : Option α} (h : o.isSome), o = some (o.get h)",
"start": [
71,
1
],
"end": [
72,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.not_isSome_iff_eq_none",
"code": "theorem not_isSome_iff_eq_none : ¬o.isSome ↔ o = none",
"start": [
74,
1
],
"end": [
75,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.ne_none_iff_isSome",
"code": "theorem ne_none_iff_isSome : o ≠ none ↔ o.isSome",
"start": [
77,
1
],
"end": [
77,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.ne_none_iff_exists",
"code": "theorem ne_none_iff_exists : o ≠ none ↔ ∃ x, some x = o",
"start": [
79,
1
],
"end": [
79,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.ne_none_iff_exists'",
"code": "theorem ne_none_iff_exists' : o ≠ none ↔ ∃ x, o = some x",
"start": [
81,
1
],
"end": [
82,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bex_ne_none",
"code": "theorem bex_ne_none {p : Option α → Prop} : (∃ x, ∃ (_ : x ≠ none), p x) ↔ ∃ x, p (some x)",
"start": [
84,
1
],
"end": [
86,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.ball_ne_none",
"code": "theorem ball_ne_none {p : Option α → Prop} : (∀ x (_ : x ≠ none), p x) ↔ ∀ x, p (some x)",
"start": [
88,
1
],
"end": [
93,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.pure_def",
"code": "@[simp] theorem pure_def : pure = @some α",
"start": [
95,
1
],
"end": [
95,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_eq_bind",
"code": "@[simp] theorem bind_eq_bind : bind = @Option.bind α β",
"start": [
97,
1
],
"end": [
97,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_some",
"code": "@[simp] theorem bind_some (x : Option α) : x.bind some = x",
"start": [
99,
1
],
"end": [
99,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_none",
"code": "@[simp] theorem bind_none (x : Option α) : x.bind (fun _ => none (α := β)) = none",
"start": [
101,
1
],
"end": [
102,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_eq_some",
"code": "theorem bind_eq_some : x.bind f = some b ↔ ∃ a, x = some a ∧ f a = some b",
"start": [
104,
1
],
"end": [
105,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_eq_none",
"code": "@[simp] theorem bind_eq_none {o : Option α} {f : α → Option β} :\n o.bind f = none ↔ ∀ a, o = some a → f a = none",
"start": [
107,
1
],
"end": [
108,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_eq_none'",
"code": "theorem bind_eq_none' {o : Option α} {f : α → Option β} :\n o.bind f = none ↔ ∀ b a, a ∈ o → b ∉ f a",
"start": [
110,
1
],
"end": [
112,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_comm",
"code": "theorem bind_comm {f : α → β → Option γ} (a : Option α) (b : Option β) :\n (a.bind fun x => b.bind (f x)) = b.bind fun y => a.bind fun x => f x y",
"start": [
114,
1
],
"end": [
116,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_assoc",
"code": "theorem bind_assoc (x : Option α) (f : α → Option β) (g : β → Option γ) :\n (x.bind f).bind g = x.bind fun y => (f y).bind g",
"start": [
118,
1
],
"end": [
119,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_eq_some",
"code": "theorem join_eq_some : x.join = some a ↔ x = some (some a)",
"start": [
121,
1
],
"end": [
122,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_ne_none",
"code": "theorem join_ne_none : x.join ≠ none ↔ ∃ z, x = some (some z)",
"start": [
124,
1
],
"end": [
125,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_ne_none'",
"code": "theorem join_ne_none' : ¬x.join = none ↔ ∃ z, x = some (some z)",
"start": [
127,
1
],
"end": [
128,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_eq_none",
"code": "theorem join_eq_none : o.join = none ↔ o = none ∨ o = some none",
"start": [
130,
1
],
"end": [
131,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_id_eq_join",
"code": "theorem bind_id_eq_join {x : Option (Option α)} : x.bind id = x.join",
"start": [
133,
1
],
"end": [
133,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_map",
"code": "@[simp] theorem map_eq_map : Functor.map f = Option.map f",
"start": [
135,
1
],
"end": [
135,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_none",
"code": "theorem map_none : f <$> none = none",
"start": [
137,
1
],
"end": [
137,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_some",
"code": "theorem map_some : f <$> some a = some (f a)",
"start": [
139,
1
],
"end": [
139,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_some'",
"code": "@[simp] theorem map_eq_some' : x.map f = some b ↔ ∃ a, x = some a ∧ f a = b",
"start": [
141,
1
],
"end": [
141,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_some",
"code": "theorem map_eq_some : f <$> x = some b ↔ ∃ a, x = some a ∧ f a = b",
"start": [
143,
1
],
"end": [
143,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_none'",
"code": "@[simp] theorem map_eq_none' : x.map f = none ↔ x = none",
"start": [
145,
1
],
"end": [
146,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_none",
"code": "theorem map_eq_none : f <$> x = none ↔ x = none",
"start": [
148,
1
],
"end": [
148,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_eq_bind",
"code": "theorem map_eq_bind {x : Option α} : x.map f = x.bind (some ∘ f)",
"start": [
150,
1
],
"end": [
151,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_congr",
"code": "theorem map_congr {x : Option α} (h : ∀ a, a ∈ x → f a = g a) : x.map f = x.map g",
"start": [
153,
1
],
"end": [
154,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_id'",
"code": "@[simp] theorem map_id' : Option.map (@id α) = id",
"start": [
156,
1
],
"end": [
156,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_id''",
"code": "@[simp] theorem map_id'' {x : Option α} : (x.map fun a => a) = x",
"start": [
157,
1
],
"end": [
157,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_map",
"code": "@[simp] theorem map_map (h : β → γ) (g : α → β) (x : Option α) :\n (x.map g).map h = x.map (h ∘ g)",
"start": [
159,
1
],
"end": [
161,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.comp_map",
"code": "theorem comp_map (h : β → γ) (g : α → β) (x : Option α) : x.map (h ∘ g) = (x.map g).map h",
"start": [
163,
1
],
"end": [
164,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_comp_map",
"code": "@[simp] theorem map_comp_map (f : α → β) (g : β → γ) :\n Option.map g ∘ Option.map f = Option.map (g ∘ f)",
"start": [
166,
1
],
"end": [
167,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mem_map_of_mem",
"code": "theorem mem_map_of_mem (g : α → β) (h : a ∈ x) : g a ∈ Option.map g x",
"start": [
169,
1
],
"end": [
169,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.bind_map_comm",
"code": "theorem bind_map_comm {α β} {x : Option (Option α)} {f : α → β} :\n x.bind (Option.map f) = (x.map (Option.map f)).bind id",
"start": [
171,
1
],
"end": [
172,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_map_eq_map_join",
"code": "theorem join_map_eq_map_join {f : α → β} {x : Option (Option α)} :\n (x.map (Option.map f)).join = x.join.map f",
"start": [
174,
1
],
"end": [
175,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.join_join",
"code": "theorem join_join {x : Option (Option (Option α))} : x.join.join = (x.map join).join",
"start": [
177,
1
],
"end": [
178,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.mem_of_mem_join",
"code": "theorem mem_of_mem_join {a : α} {x : Option (Option α)} (h : a ∈ x.join) : some a ∈ x",
"start": [
180,
1
],
"end": [
181,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.some_orElse",
"code": "@[simp] theorem some_orElse (a : α) (x : Option α) : (some a <|> x) = some a",
"start": [
183,
1
],
"end": [
183,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.none_orElse",
"code": "@[simp] theorem none_orElse (x : Option α) : (none <|> x) = x",
"start": [
185,
1
],
"end": [
185,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.orElse_none",
"code": "@[simp] theorem orElse_none (x : Option α) : (x <|> none) = x",
"start": [
187,
1
],
"end": [
187,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.map_orElse",
"code": "theorem map_orElse {x y : Option α} : (x <|> y).map f = (x.map f <|> y.map f)",
"start": [
189,
1
],
"end": [
190,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.guard_eq_some",
"code": "@[simp] theorem guard_eq_some [DecidablePred p] : guard p a = some b ↔ a = b ∧ p a",
"start": [
192,
1
],
"end": [
193,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.liftOrGet_eq_or_eq",
"code": "theorem liftOrGet_eq_or_eq {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :\n ∀ o₁ o₂, liftOrGet f o₁ o₂ = o₁ ∨ liftOrGet f o₁ o₂ = o₂",
"start": [
195,
1
],
"end": [
200,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.liftOrGet_none_left",
"code": "@[simp] theorem liftOrGet_none_left {f} {b : Option α} : liftOrGet f none b = b",
"start": [
202,
1
],
"end": [
203,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.liftOrGet_none_right",
"code": "@[simp] theorem liftOrGet_none_right {f} {a : Option α} : liftOrGet f a none = a",
"start": [
205,
1
],
"end": [
206,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.liftOrGet_some_some",
"code": "@[simp] theorem liftOrGet_some_some {f} {a b : α} :\n liftOrGet f (some a) (some b) = f a b",
"start": [
208,
1
],
"end": [
209,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.elim_none",
"code": "@[simp] theorem elim_none (x : β) (f : α → β) : none.elim x f = x",
"start": [
211,
1
],
"end": [
211,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.elim_some",
"code": "@[simp] theorem elim_some (x : β) (f : α → β) (a : α) : (some a).elim x f = f a",
"start": [
213,
1
],
"end": [
213,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.getD_map",
"code": "@[simp] theorem getD_map (f : α → β) (x : α) (o : Option α) :\n (o.map f).getD (f x) = f (getD o x)",
"start": [
215,
1
],
"end": [
216,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.choice",
"code": "noncomputable def choice (α : Type _) : Option α :=\n if h : Nonempty α then some (Classical.choice h) else none",
"start": [
222,
1
],
"end": [
224,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.choice_eq",
"code": "theorem choice_eq {α : Type _} [Subsingleton α] (a : α) : choice α = some a",
"start": [
226,
1
],
"end": [
229,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.choice_isSome_iff_nonempty",
"code": "theorem choice_isSome_iff_nonempty {α : Type _} : (choice α).isSome ↔ Nonempty α",
"start": [
231,
1
],
"end": [
232,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toList_some",
"code": "@[simp] theorem toList_some (a : α) : (a : Option α).toList = [a]",
"start": [
236,
1
],
"end": [
236,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.toList_none",
"code": "@[simp] theorem toList_none (α : Type _) : (none : Option α).toList = []",
"start": [
238,
1
],
"end": [
238,
80
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Gcd.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Dvd.lean",
".lake/packages/lean4/src/lean/Init/RCases.lean",
".lake/packages/lean4/src/lean/Init/NotationExtra.lean"
] | [
{
"full_name": "Nat.gcd",
"code": "@[extern \"lean_nat_gcd\"]\ndef gcd (m n : @& Nat) : Nat :=\n if m = 0 then\n n\n else\n gcd (n % m) m\n termination_by m\n decreasing_by simp_wf; apply mod_lt _ (zero_lt_of_ne_zero _); assumption",
"start": [
13,
1
],
"end": [
38,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_zero_left",
"code": "@[simp] theorem gcd_zero_left (y : Nat) : gcd 0 y = y",
"start": [
40,
1
],
"end": [
41,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_succ",
"code": "theorem gcd_succ (x y : Nat) : gcd (succ x) y = gcd (y % succ x) (succ x)",
"start": [
43,
1
],
"end": [
44,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_add_one",
"code": "theorem gcd_add_one (x y : Nat) : gcd (x + 1) y = gcd (y % (x + 1)) (x + 1)",
"start": [
46,
1
],
"end": [
47,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_one_left",
"code": "@[simp] theorem gcd_one_left (n : Nat) : gcd 1 n = 1",
"start": [
49,
1
],
"end": [
51,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_zero_right",
"code": "@[simp] theorem gcd_zero_right (n : Nat) : gcd n 0 = n",
"start": [
53,
1
],
"end": [
59,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_self",
"code": "@[simp] theorem gcd_self (n : Nat) : gcd n n = n",
"start": [
64,
1
],
"end": [
65,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_rec",
"code": "theorem gcd_rec (m n : Nat) : gcd m n = gcd (n % m) m",
"start": [
68,
1
],
"end": [
71,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd.induction",
"code": "@[elab_as_elim] theorem gcd.induction {P : Nat → Nat → Prop} (m n : Nat)\n (H0 : ∀n, P 0 n) (H1 : ∀ m n, 0 < m → P (n % m) m → P m n) : P m n",
"start": [
73,
1
],
"end": [
79,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd",
"code": "theorem gcd_dvd (m n : Nat) : (gcd m n ∣ m) ∧ (gcd m n ∣ n)",
"start": [
81,
1
],
"end": [
84,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_left",
"code": "theorem gcd_dvd_left (m n : Nat) : gcd m n ∣ m",
"start": [
86,
1
],
"end": [
86,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_right",
"code": "theorem gcd_dvd_right (m n : Nat) : gcd m n ∣ n",
"start": [
88,
1
],
"end": [
88,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_le_left",
"code": "theorem gcd_le_left (n) (h : 0 < m) : gcd m n ≤ m",
"start": [
90,
1
],
"end": [
90,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_le_right",
"code": "theorem gcd_le_right (n) (h : 0 < n) : gcd m n ≤ n",
"start": [
92,
1
],
"end": [
92,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_gcd",
"code": "theorem dvd_gcd : k ∣ m → k ∣ n → k ∣ gcd m n",
"start": [
94,
1
],
"end": [
97,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_gcd_iff",
"code": "theorem dvd_gcd_iff : k ∣ gcd m n ↔ k ∣ m ∧ k ∣ n",
"start": [
99,
1
],
"end": [
101,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_comm",
"code": "theorem gcd_comm (m n : Nat) : gcd m n = gcd n m",
"start": [
103,
1
],
"end": [
106,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_left_iff_dvd",
"code": "theorem gcd_eq_left_iff_dvd : m ∣ n ↔ gcd m n = m",
"start": [
109,
1
],
"end": [
111,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_right_iff_dvd",
"code": "theorem gcd_eq_right_iff_dvd : m ∣ n ↔ gcd n m = m",
"start": [
113,
1
],
"end": [
114,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_assoc",
"code": "theorem gcd_assoc (m n k : Nat) : gcd (gcd m n) k = gcd m (gcd n k)",
"start": [
116,
1
],
"end": [
125,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_one_right",
"code": "@[simp] theorem gcd_one_right (n : Nat) : gcd n 1 = 1",
"start": [
127,
1
],
"end": [
127,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_left",
"code": "theorem gcd_mul_left (m n k : Nat) : gcd (m * n) (m * k) = m * gcd n k",
"start": [
129,
1
],
"end": [
132,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_right",
"code": "theorem gcd_mul_right (m n k : Nat) : gcd (m * n) (k * n) = gcd m k * n",
"start": [
134,
1
],
"end": [
135,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_pos_of_pos_left",
"code": "theorem gcd_pos_of_pos_left {m : Nat} (n : Nat) (mpos : 0 < m) : 0 < gcd m n",
"start": [
137,
1
],
"end": [
138,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_pos_of_pos_right",
"code": "theorem gcd_pos_of_pos_right (m : Nat) {n : Nat} (npos : 0 < n) : 0 < gcd m n",
"start": [
140,
1
],
"end": [
141,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_gcd_pos_of_pos_left",
"code": "theorem div_gcd_pos_of_pos_left (b : Nat) (h : 0 < a) : 0 < a / a.gcd b",
"start": [
143,
1
],
"end": [
144,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_gcd_pos_of_pos_right",
"code": "theorem div_gcd_pos_of_pos_right (a : Nat) (h : 0 < b) : 0 < b / a.gcd b",
"start": [
146,
1
],
"end": [
147,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_gcd_eq_zero_left",
"code": "theorem eq_zero_of_gcd_eq_zero_left {m n : Nat} (H : gcd m n = 0) : m = 0",
"start": [
149,
1
],
"end": [
152,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_gcd_eq_zero_right",
"code": "theorem eq_zero_of_gcd_eq_zero_right {m n : Nat} (H : gcd m n = 0) : n = 0",
"start": [
154,
1
],
"end": [
156,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_ne_zero_left",
"code": "theorem gcd_ne_zero_left : m ≠ 0 → gcd m n ≠ 0",
"start": [
158,
1
],
"end": [
158,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_ne_zero_right",
"code": "theorem gcd_ne_zero_right : n ≠ 0 → gcd m n ≠ 0",
"start": [
160,
1
],
"end": [
160,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_div",
"code": "theorem gcd_div {m n k : Nat} (H1 : k ∣ m) (H2 : k ∣ n) :\n gcd (m / k) (n / k) = gcd m n / k",
"start": [
162,
1
],
"end": [
169,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_of_dvd_left",
"code": "theorem gcd_dvd_gcd_of_dvd_left {m k : Nat} (n : Nat) (H : m ∣ k) : gcd m n ∣ gcd k n",
"start": [
171,
1
],
"end": [
172,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_of_dvd_right",
"code": "theorem gcd_dvd_gcd_of_dvd_right {m k : Nat} (n : Nat) (H : m ∣ k) : gcd n m ∣ gcd n k",
"start": [
174,
1
],
"end": [
175,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_mul_left",
"code": "theorem gcd_dvd_gcd_mul_left (m n k : Nat) : gcd m n ∣ gcd (k * m) n",
"start": [
177,
1
],
"end": [
178,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_mul_right",
"code": "theorem gcd_dvd_gcd_mul_right (m n k : Nat) : gcd m n ∣ gcd (m * k) n",
"start": [
180,
1
],
"end": [
181,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_mul_left_right",
"code": "theorem gcd_dvd_gcd_mul_left_right (m n k : Nat) : gcd m n ∣ gcd m (k * n)",
"start": [
183,
1
],
"end": [
184,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_dvd_gcd_mul_right_right",
"code": "theorem gcd_dvd_gcd_mul_right_right (m n k : Nat) : gcd m n ∣ gcd m (n * k)",
"start": [
186,
1
],
"end": [
187,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_left",
"code": "theorem gcd_eq_left {m n : Nat} (H : m ∣ n) : gcd m n = m",
"start": [
189,
1
],
"end": [
190,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_right",
"code": "theorem gcd_eq_right {m n : Nat} (H : n ∣ m) : gcd m n = n",
"start": [
192,
1
],
"end": [
193,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_left_left",
"code": "@[simp] theorem gcd_mul_left_left (m n : Nat) : gcd (m * n) n = n",
"start": [
195,
1
],
"end": [
196,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_left_right",
"code": "@[simp] theorem gcd_mul_left_right (m n : Nat) : gcd n (m * n) = n",
"start": [
198,
1
],
"end": [
199,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_right_left",
"code": "@[simp] theorem gcd_mul_right_left (m n : Nat) : gcd (n * m) n = n",
"start": [
201,
1
],
"end": [
202,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_right_right",
"code": "@[simp] theorem gcd_mul_right_right (m n : Nat) : gcd n (n * m) = n",
"start": [
204,
1
],
"end": [
205,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_gcd_self_right_left",
"code": "@[simp] theorem gcd_gcd_self_right_left (m n : Nat) : gcd m (gcd m n) = gcd m n",
"start": [
207,
1
],
"end": [
208,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_gcd_self_right_right",
"code": "@[simp] theorem gcd_gcd_self_right_right (m n : Nat) : gcd m (gcd n m) = gcd n m",
"start": [
210,
1
],
"end": [
211,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_gcd_self_left_right",
"code": "@[simp] theorem gcd_gcd_self_left_right (m n : Nat) : gcd (gcd n m) m = gcd n m",
"start": [
213,
1
],
"end": [
214,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_gcd_self_left_left",
"code": "@[simp] theorem gcd_gcd_self_left_left (m n : Nat) : gcd (gcd m n) m = gcd m n",
"start": [
216,
1
],
"end": [
217,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_add_mul_self",
"code": "theorem gcd_add_mul_self (m n k : Nat) : gcd m (n + k * m) = gcd m n",
"start": [
219,
1
],
"end": [
220,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_zero_iff",
"code": "theorem gcd_eq_zero_iff {i j : Nat} : gcd i j = 0 ↔ i = 0 ∧ j = 0",
"start": [
222,
1
],
"end": [
224,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_eq_iff",
"code": "theorem gcd_eq_iff (a b : Nat) :\n gcd a b = g ↔ g ∣ a ∧ g ∣ b ∧ (∀ c, c ∣ a → c ∣ b → c ∣ g)",
"start": [
226,
1
],
"end": [
237,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.prod_dvd_and_dvd_of_dvd_prod",
"code": "def prod_dvd_and_dvd_of_dvd_prod {k m n : Nat} (H : k ∣ m * n) :\n {d : {m' // m' ∣ m} × {n' // n' ∣ n} // k = d.1.val * d.2.val} :=\n if h0 : gcd k m = 0 then\n ⟨⟨⟨0, eq_zero_of_gcd_eq_zero_right h0 ▸ Nat.dvd_refl 0⟩,\n ⟨n, Nat.dvd_refl n⟩⟩,\n eq_zero_of_gcd_eq_zero_left h0 ▸ (Nat.zero_mul n).symm⟩\n else by\n have hd : gcd k m * (k / gcd k m) = k := Nat.mul_div_cancel' (gcd_dvd_left k m)\n refine ⟨⟨⟨gcd k m, gcd_dvd_right k m⟩, ⟨k / gcd k m, ?_⟩⟩, hd.symm⟩\n apply Nat.dvd_of_mul_dvd_mul_left (Nat.pos_of_ne_zero h0)\n rw [hd, ← gcd_mul_right]\n exact Nat.dvd_gcd (Nat.dvd_mul_right _ _) H",
"start": [
239,
1
],
"end": [
251,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.gcd_mul_dvd_mul_gcd",
"code": "theorem gcd_mul_dvd_mul_gcd (k m n : Nat) : gcd k (m * n) ∣ gcd k m * gcd k n",
"start": [
253,
1
],
"end": [
260,
62
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Int/DivModLemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Int/DivMod.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Dvd.lean",
".lake/packages/lean4/src/lean/Init/RCases.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Order.lean"
] | [
{
"full_name": "Int.dvd_def",
"code": "protected theorem dvd_def (a b : Int) : (a ∣ b) = Exists (fun c => b = a * c)",
"start": [
26,
1
],
"end": [
26,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_zero",
"code": "protected theorem dvd_zero (n : Int) : n ∣ 0",
"start": [
28,
1
],
"end": [
28,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_refl",
"code": "protected theorem dvd_refl (n : Int) : n ∣ n",
"start": [
30,
1
],
"end": [
30,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.one_dvd",
"code": "protected theorem one_dvd (n : Int) : 1 ∣ n",
"start": [
32,
1
],
"end": [
32,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_trans",
"code": "protected theorem dvd_trans : ∀ {a b c : Int}, a ∣ b → b ∣ c → a ∣ c",
"start": [
34,
1
],
"end": [
35,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_dvd",
"code": "@[norm_cast] theorem ofNat_dvd {m n : Nat} : (↑m : Int) ∣ ↑n ↔ m ∣ n",
"start": [
37,
1
],
"end": [
45,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_antisymm",
"code": "theorem dvd_antisymm {a b : Int} (H1 : 0 ≤ a) (H2 : 0 ≤ b) : a ∣ b → b ∣ a → a = b",
"start": [
47,
1
],
"end": [
50,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_dvd",
"code": "@[simp] protected theorem zero_dvd {n : Int} : 0 ∣ n ↔ n = 0",
"start": [
52,
1
],
"end": [
54,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_mul_right",
"code": "protected theorem dvd_mul_right (a b : Int) : a ∣ a * b",
"start": [
56,
1
],
"end": [
56,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_mul_left",
"code": "protected theorem dvd_mul_left (a b : Int) : b ∣ a * b",
"start": [
58,
1
],
"end": [
58,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_dvd",
"code": "protected theorem neg_dvd {a b : Int} : -a ∣ b ↔ a ∣ b",
"start": [
60,
1
],
"end": [
62,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_neg",
"code": "protected theorem dvd_neg {a b : Int} : a ∣ -b ↔ a ∣ b",
"start": [
64,
1
],
"end": [
66,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_dvd_natAbs",
"code": "@[simp] theorem natAbs_dvd_natAbs {a b : Int} : natAbs a ∣ natAbs b ↔ a ∣ b",
"start": [
68,
1
],
"end": [
73,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_dvd_left",
"code": "theorem ofNat_dvd_left {n : Nat} {z : Int} : (↑n : Int) ∣ z ↔ n ∣ z.natAbs",
"start": [
75,
1
],
"end": [
76,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_add",
"code": "protected theorem dvd_add : ∀ {a b c : Int}, a ∣ b → a ∣ c → a ∣ b + c",
"start": [
78,
1
],
"end": [
79,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_sub",
"code": "protected theorem dvd_sub : ∀ {a b c : Int}, a ∣ b → a ∣ c → a ∣ b - c",
"start": [
81,
1
],
"end": [
82,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_add_left",
"code": "protected theorem dvd_add_left {a b c : Int} (H : a ∣ c) : a ∣ b + c ↔ a ∣ b",
"start": [
84,
1
],
"end": [
85,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_add_right",
"code": "protected theorem dvd_add_right {a b c : Int} (H : a ∣ b) : a ∣ b + c ↔ a ∣ c",
"start": [
87,
1
],
"end": [
88,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_iff_dvd_of_dvd_sub",
"code": "protected theorem dvd_iff_dvd_of_dvd_sub {a b c : Int} (H : a ∣ b - c) : a ∣ b ↔ a ∣ c",
"start": [
90,
1
],
"end": [
92,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_iff_dvd_of_dvd_add",
"code": "protected theorem dvd_iff_dvd_of_dvd_add {a b c : Int} (H : a ∣ b + c) : a ∣ b ↔ a ∣ c",
"start": [
94,
1
],
"end": [
95,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_dvd",
"code": "theorem le_of_dvd {a b : Int} (bpos : 0 < b) (H : a ∣ b) : a ≤ b",
"start": [
97,
1
],
"end": [
100,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_dvd",
"code": "theorem natAbs_dvd {a b : Int} : (a.natAbs : Int) ∣ b ↔ a ∣ b",
"start": [
102,
1
],
"end": [
105,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_natAbs",
"code": "theorem dvd_natAbs {a b : Int} : a ∣ b.natAbs ↔ a ∣ b",
"start": [
107,
1
],
"end": [
110,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_dvd_self",
"code": "theorem natAbs_dvd_self {a : Int} : (a.natAbs : Int) ∣ a",
"start": [
112,
1
],
"end": [
114,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_natAbs_self",
"code": "theorem dvd_natAbs_self {a : Int} : a ∣ (a.natAbs : Int)",
"start": [
116,
1
],
"end": [
118,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_dvd_right",
"code": "theorem ofNat_dvd_right {n : Nat} {z : Int} : z ∣ (↑n : Int) ↔ z.natAbs ∣ n",
"start": [
120,
1
],
"end": [
121,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_one_of_dvd_one",
"code": "theorem eq_one_of_dvd_one {a : Int} (H : 0 ≤ a) (H' : a ∣ 1) : a = 1",
"start": [
123,
1
],
"end": [
125,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_one_of_mul_eq_one_right",
"code": "theorem eq_one_of_mul_eq_one_right {a b : Int} (H : 0 ≤ a) (H' : a * b = 1) : a = 1",
"start": [
127,
1
],
"end": [
128,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_one_of_mul_eq_one_left",
"code": "theorem eq_one_of_mul_eq_one_left {a b : Int} (H : 0 ≤ b) (H' : a * b = 1) : b = 1",
"start": [
130,
1
],
"end": [
131,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_ediv",
"code": "@[simp] theorem zero_ediv : ∀ b : Int, 0 / b = 0",
"start": [
135,
1
],
"end": [
137,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_zero",
"code": "@[simp] protected theorem ediv_zero : ∀ a : Int, a / 0 = 0",
"start": [
139,
1
],
"end": [
141,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_div",
"code": "@[simp] protected theorem zero_div : ∀ b : Int, div 0 b = 0",
"start": [
143,
1
],
"end": [
145,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_zero",
"code": "@[simp] protected theorem div_zero : ∀ a : Int, div a 0 = 0",
"start": [
148,
1
],
"end": [
150,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_fdiv",
"code": "@[simp] theorem zero_fdiv (b : Int) : fdiv 0 b = 0",
"start": [
152,
1
],
"end": [
152,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_zero",
"code": "@[simp] protected theorem fdiv_zero : ∀ a : Int, fdiv a 0 = 0",
"start": [
155,
1
],
"end": [
158,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_ediv",
"code": "theorem div_eq_ediv : ∀ {a b : Int}, 0 ≤ a → 0 ≤ b → a.div b = a / b",
"start": [
162,
1
],
"end": [
164,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_eq_ediv",
"code": "theorem fdiv_eq_ediv : ∀ (a : Int) {b : Int}, 0 ≤ b → fdiv a b = a / b",
"start": [
166,
1
],
"end": [
168,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_eq_div",
"code": "theorem fdiv_eq_div {a b : Int} (Ha : 0 ≤ a) (Hb : 0 ≤ b) : fdiv a b = div a b",
"start": [
170,
1
],
"end": [
171,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_emod",
"code": "@[simp] theorem zero_emod (b : Int) : 0 % b = 0",
"start": [
175,
1
],
"end": [
175,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_zero",
"code": "@[simp] theorem emod_zero : ∀ a : Int, a % 0 = a",
"start": [
177,
1
],
"end": [
179,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_mod",
"code": "@[simp] theorem zero_mod (b : Int) : mod 0 b = 0",
"start": [
181,
1
],
"end": [
181,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_zero",
"code": "@[simp] theorem mod_zero : ∀ a : Int, mod a 0 = a",
"start": [
183,
1
],
"end": [
185,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.zero_fmod",
"code": "@[simp] theorem zero_fmod (b : Int) : fmod 0 b = 0",
"start": [
187,
1
],
"end": [
187,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_zero",
"code": "@[simp] theorem fmod_zero : ∀ a : Int, fmod a 0 = a",
"start": [
189,
1
],
"end": [
192,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_emod",
"code": "@[simp, norm_cast] theorem ofNat_emod (m n : Nat) : (↑(m % n) : Int) = m % n",
"start": [
196,
1
],
"end": [
196,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_ediv",
"code": "theorem emod_add_ediv : ∀ a b : Int, a % b + b * (a / b) = a",
"start": [
201,
1
],
"end": [
213,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_ediv'",
"code": "theorem emod_add_ediv' (a b : Int) : a % b + a / b * b = a",
"start": [
215,
1
],
"end": [
216,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_add_emod",
"code": "theorem ediv_add_emod (a b : Int) : b * (a / b) + a % b = a",
"start": [
218,
1
],
"end": [
219,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_add_emod'",
"code": "theorem ediv_add_emod' (a b : Int) : a / b * b + a % b = a",
"start": [
221,
1
],
"end": [
222,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_def",
"code": "theorem emod_def (a b : Int) : a % b = a - b * (a / b)",
"start": [
224,
1
],
"end": [
225,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_add_div",
"code": "theorem mod_add_div : ∀ a b : Int, mod a b + b * (a.div b) = a",
"start": [
227,
1
],
"end": [
242,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_add_mod",
"code": "theorem div_add_mod (a b : Int) : b * a.div b + mod a b = a",
"start": [
244,
1
],
"end": [
245,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_add_div'",
"code": "theorem mod_add_div' (m k : Int) : mod m k + m.div k * k = m",
"start": [
247,
1
],
"end": [
248,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_add_mod'",
"code": "theorem div_add_mod' (m k : Int) : m.div k * k + mod m k = m",
"start": [
250,
1
],
"end": [
251,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_def",
"code": "theorem mod_def (a b : Int) : mod a b = a - b * a.div b",
"start": [
253,
1
],
"end": [
254,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_add_fdiv",
"code": "theorem fmod_add_fdiv : ∀ a b : Int, a.fmod b + b * a.fdiv b = a",
"start": [
256,
1
],
"end": [
271,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_add_fmod",
"code": "theorem fdiv_add_fmod (a b : Int) : b * a.fdiv b + a.fmod b = a",
"start": [
273,
1
],
"end": [
274,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_def",
"code": "theorem fmod_def (a b : Int) : a.fmod b = a - b * a.fdiv b",
"start": [
276,
1
],
"end": [
277,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_eq_emod",
"code": "theorem fmod_eq_emod (a : Int) {b : Int} (hb : 0 ≤ b) : fmod a b = a % b",
"start": [
281,
1
],
"end": [
282,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_eq_emod",
"code": "theorem mod_eq_emod {a b : Int} (ha : 0 ≤ a) (hb : 0 ≤ b) : mod a b = a % b",
"start": [
284,
1
],
"end": [
285,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_eq_mod",
"code": "theorem fmod_eq_mod {a b : Int} (Ha : 0 ≤ a) (Hb : 0 ≤ b) : fmod a b = mod a b",
"start": [
287,
1
],
"end": [
288,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_neg",
"code": "@[simp] protected theorem ediv_neg : ∀ a b : Int, a / (-b) = -(a / b)",
"start": [
292,
1
],
"end": [
295,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_neg'",
"code": "theorem ediv_neg' {a b : Int} (Ha : a < 0) (Hb : 0 < b) : a / b < 0",
"start": [
297,
1
],
"end": [
299,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_def",
"code": "protected theorem div_def (a b : Int) : a / b = Int.ediv a b",
"start": [
301,
1
],
"end": [
301,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_ediv",
"code": "theorem negSucc_ediv (m : Nat) {b : Int} (H : 0 < b) : -[m+1] / b = -(div m b + 1)",
"start": [
303,
1
],
"end": [
305,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_nonneg",
"code": "theorem ediv_nonneg {a b : Int} (Ha : 0 ≤ a) (Hb : 0 ≤ b) : 0 ≤ a / b",
"start": [
307,
1
],
"end": [
309,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_nonpos",
"code": "theorem ediv_nonpos {a b : Int} (Ha : 0 ≤ a) (Hb : b ≤ 0) : a / b ≤ 0",
"start": [
311,
1
],
"end": [
312,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_mul_ediv_right",
"code": "theorem add_mul_ediv_right (a b : Int) {c : Int} (H : c ≠ 0) : (a + b * c) / c = a / c + b",
"start": [
314,
1
],
"end": [
342,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_ediv_of_dvd_right",
"code": "theorem add_ediv_of_dvd_right {a b c : Int} (H : c ∣ b) : (a + b) / c = a / c + b / c",
"start": [
344,
1
],
"end": [
348,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_ediv_of_dvd_left",
"code": "theorem add_ediv_of_dvd_left {a b c : Int} (H : c ∣ a) : (a + b) / c = a / c + b / c",
"start": [
350,
1
],
"end": [
351,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_cancel",
"code": "@[simp] theorem mul_ediv_cancel (a : Int) {b : Int} (H : b ≠ 0) : (a * b) / b = a",
"start": [
353,
1
],
"end": [
355,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_cancel_left",
"code": "@[simp] theorem mul_ediv_cancel_left (b : Int) (H : a ≠ 0) : (a * b) / a = b",
"start": [
357,
1
],
"end": [
358,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_nonneg_iff_of_pos",
"code": "theorem div_nonneg_iff_of_pos {a b : Int} (h : 0 < b) : a / b ≥ 0 ↔ a ≥ 0",
"start": [
360,
1
],
"end": [
365,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_zero_of_lt",
"code": "theorem ediv_eq_zero_of_lt {a b : Int} (H1 : 0 ≤ a) (H2 : a < b) : a / b = 0",
"start": [
367,
1
],
"end": [
369,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_mul_ediv_left",
"code": "theorem add_mul_ediv_left (a : Int) {b : Int}\n (c : Int) (H : b ≠ 0) : (a + b * c) / b = a / b + c",
"start": [
371,
1
],
"end": [
373,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_mul_of_pos",
"code": "@[simp] theorem mul_ediv_mul_of_pos {a : Int}\n (b c : Int) (H : 0 < a) : (a * b) / (a * c) = b / c",
"start": [
375,
1
],
"end": [
397,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_mul_of_pos_left",
"code": "@[simp] theorem mul_ediv_mul_of_pos_left\n (a : Int) {b : Int} (c : Int) (H : 0 < b) : (a * b) / (c * b) = a / c",
"start": [
399,
1
],
"end": [
401,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_of_eq_mul_right",
"code": "protected theorem ediv_eq_of_eq_mul_right {a b c : Int}\n (H1 : b ≠ 0) (H2 : a = b * c) : a / b = c",
"start": [
403,
1
],
"end": [
404,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_ediv_of_mul_eq_right",
"code": "protected theorem eq_ediv_of_mul_eq_right {a b c : Int}\n (H1 : a ≠ 0) (H2 : a * b = c) : b = c / a",
"start": [
406,
1
],
"end": [
408,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_of_eq_mul_left",
"code": "protected theorem ediv_eq_of_eq_mul_left {a b c : Int}\n (H1 : b ≠ 0) (H2 : a = c * b) : a / b = c",
"start": [
410,
1
],
"end": [
412,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_def'",
"code": "theorem mod_def' (m n : Int) : m % n = emod m n",
"start": [
416,
1
],
"end": [
416,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.negSucc_emod",
"code": "theorem negSucc_emod (m : Nat) {b : Int} (bpos : 0 < b) : -[m+1] % b = b - 1 - m % b",
"start": [
418,
1
],
"end": [
421,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_negSucc",
"code": "theorem emod_negSucc (m : Nat) (n : Int) :\n (Int.negSucc m) % n = Int.subNatNat (Int.natAbs n) (Nat.succ (m % Int.natAbs n))",
"start": [
423,
1
],
"end": [
424,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mod_ofNat",
"code": "theorem ofNat_mod_ofNat (m n : Nat) : (m % n : Int) = ↑(m % n)",
"start": [
426,
1
],
"end": [
426,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_nonneg",
"code": "theorem emod_nonneg : ∀ (a : Int) {b : Int}, b ≠ 0 → 0 ≤ a % b",
"start": [
428,
1
],
"end": [
430,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_lt_of_pos",
"code": "theorem emod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) : a % b < b",
"start": [
432,
1
],
"end": [
435,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_self_le",
"code": "theorem mul_ediv_self_le {x k : Int} (h : k ≠ 0) : k * (x / k) ≤ x",
"start": [
437,
1
],
"end": [
440,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_mul_ediv_self_add",
"code": "theorem lt_mul_ediv_self_add {x k : Int} (h : 0 < k) : x < k * (x / k) + k",
"start": [
442,
1
],
"end": [
445,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_mul_emod_self",
"code": "@[simp] theorem add_mul_emod_self {a b c : Int} : (a + b * c) % c = a % c",
"start": [
447,
1
],
"end": [
452,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_mul_emod_self_left",
"code": "@[simp] theorem add_mul_emod_self_left (a b c : Int) : (a + b * c) % b = a % b",
"start": [
454,
1
],
"end": [
455,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod_self",
"code": "@[simp] theorem add_emod_self {a b : Int} : (a + b) % b = a % b",
"start": [
457,
1
],
"end": [
458,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod_self_left",
"code": "@[simp] theorem add_emod_self_left {a b : Int} : (a + b) % a = b % a",
"start": [
460,
1
],
"end": [
461,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_emod",
"code": "theorem neg_emod {a b : Int} : -a % b = (b - a) % b",
"start": [
463,
1
],
"end": [
464,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_neg",
"code": "@[simp] theorem emod_neg (a b : Int) : a % -b = a % b",
"start": [
466,
1
],
"end": [
467,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_emod",
"code": "@[simp] theorem emod_add_emod (m n k : Int) : (m % n + k) % n = (m + k) % n",
"start": [
469,
1
],
"end": [
471,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod_emod",
"code": "@[simp] theorem add_emod_emod (m n k : Int) : (m + n % k) % k = (m + n) % k",
"start": [
473,
1
],
"end": [
474,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod",
"code": "theorem add_emod (a b n : Int) : (a + b) % n = (a % n + b % n) % n",
"start": [
476,
1
],
"end": [
477,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod_eq_add_emod_right",
"code": "theorem add_emod_eq_add_emod_right {m n k : Int} (i : Int)\n (H : m % n = k % n) : (m + i) % n = (k + i) % n",
"start": [
479,
1
],
"end": [
481,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_cancel_right",
"code": "theorem emod_add_cancel_right {m n k : Int} (i) : (m + i) % n = (k + i) % n ↔ m % n = k % n",
"start": [
483,
1
],
"end": [
487,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_emod_left",
"code": "@[simp] theorem mul_emod_left (a b : Int) : (a * b) % b = 0",
"start": [
489,
1
],
"end": [
490,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_emod_right",
"code": "@[simp] theorem mul_emod_right (a b : Int) : (a * b) % a = 0",
"start": [
492,
1
],
"end": [
493,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_emod",
"code": "theorem mul_emod (a b n : Int) : (a * b) % n = (a % n) * (b % n) % n",
"start": [
495,
1
],
"end": [
499,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_self",
"code": "@[local simp] theorem emod_self {a : Int} : a % a = 0",
"start": [
501,
1
],
"end": [
502,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_emod_of_dvd",
"code": "@[simp] theorem emod_emod_of_dvd (n : Int) {m k : Int}\n (h : m ∣ k) : (n % k) % m = n % m",
"start": [
504,
1
],
"end": [
508,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_emod",
"code": "@[simp] theorem emod_emod (a b : Int) : (a % b) % b = a % b",
"start": [
510,
1
],
"end": [
511,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_emod",
"code": "theorem sub_emod (a b n : Int) : (a - b) % n = (a % n - b % n) % n",
"start": [
513,
1
],
"end": [
515,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_eq_of_lt",
"code": "theorem emod_eq_of_lt {a b : Int} (H1 : 0 ≤ a) (H2 : a < b) : a % b = a",
"start": [
517,
1
],
"end": [
520,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_self_add_one",
"code": "@[simp] theorem emod_self_add_one {x : Int} (h : 0 ≤ x) : x % (x + 1) = x",
"start": [
522,
1
],
"end": [
523,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_cancel_of_emod_eq_zero",
"code": "theorem mul_ediv_cancel_of_emod_eq_zero {a b : Int} (H : a % b = 0) : b * (a / b) = a",
"start": [
527,
1
],
"end": [
528,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_mul_cancel_of_emod_eq_zero",
"code": "theorem ediv_mul_cancel_of_emod_eq_zero {a b : Int} (H : a % b = 0) : a / b * b = a",
"start": [
530,
1
],
"end": [
531,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_two_eq",
"code": "theorem emod_two_eq (x : Int) : x % 2 = 0 ∨ x % 2 = 1",
"start": [
533,
1
],
"end": [
538,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_emod_eq_add_emod_left",
"code": "theorem add_emod_eq_add_emod_left {m n k : Int} (i : Int)\n (H : m % n = k % n) : (i + m) % n = (i + k) % n",
"start": [
540,
1
],
"end": [
542,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_cancel_left",
"code": "theorem emod_add_cancel_left {m n k i : Int} : (i + m) % n = (i + k) % n ↔ m % n = k % n",
"start": [
544,
1
],
"end": [
545,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_sub_cancel_right",
"code": "theorem emod_sub_cancel_right {m n k : Int} (i) : (m - i) % n = (k - i) % n ↔ m % n = k % n",
"start": [
547,
1
],
"end": [
548,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_eq_emod_iff_emod_sub_eq_zero",
"code": "theorem emod_eq_emod_iff_emod_sub_eq_zero {m n k : Int} : m % n = k % n ↔ (m - k) % n = 0",
"start": [
550,
1
],
"end": [
551,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_emod_unique",
"code": "protected theorem ediv_emod_unique {a b r q : Int} (h : 0 < b) :\n a / b = q ∧ a % b = r ↔ r + b * q = a ∧ 0 ≤ r ∧ r < b",
"start": [
553,
1
],
"end": [
562,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_emod_mul_of_pos",
"code": "@[simp] theorem mul_emod_mul_of_pos\n {a : Int} (b c : Int) (H : 0 < a) : (a * b) % (a * c) = a * (b % c)",
"start": [
564,
1
],
"end": [
566,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_ediv_add_one_mul_self",
"code": "theorem lt_ediv_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) : a < (a / b + 1) * b",
"start": [
568,
1
],
"end": [
570,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_div_le_natAbs",
"code": "theorem natAbs_div_le_natAbs (a b : Int) : natAbs (a / b) ≤ natAbs a",
"start": [
572,
1
],
"end": [
580,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_le_self",
"code": "theorem ediv_le_self {a : Int} (b : Int) (Ha : 0 ≤ a) : a / b ≤ a",
"start": [
582,
1
],
"end": [
584,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_of_emod_eq_zero",
"code": "theorem dvd_of_emod_eq_zero {a b : Int} (H : b % a = 0) : a ∣ b",
"start": [
586,
1
],
"end": [
587,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_emod_sub_self",
"code": "theorem dvd_emod_sub_self {x : Int} {m : Nat} : (m : Int) ∣ x % m - x",
"start": [
589,
1
],
"end": [
591,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_eq_zero_of_dvd",
"code": "theorem emod_eq_zero_of_dvd : ∀ {a b : Int}, a ∣ b → b % a = 0",
"start": [
593,
1
],
"end": [
594,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_iff_emod_eq_zero",
"code": "theorem dvd_iff_emod_eq_zero (a b : Int) : a ∣ b ↔ b % a = 0",
"start": [
596,
1
],
"end": [
597,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.decidableDvd",
"code": "instance decidableDvd : DecidableRel (α := Int) (· ∣ ·) := fun _ _ =>\n decidable_of_decidable_of_iff (dvd_iff_emod_eq_zero ..).symm",
"start": [
599,
1
],
"end": [
600,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_pos_of_not_dvd",
"code": "theorem emod_pos_of_not_dvd {a b : Int} (h : ¬ a ∣ b) : a = 0 ∨ 0 < b % a",
"start": [
602,
1
],
"end": [
606,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_assoc",
"code": "protected theorem mul_ediv_assoc (a : Int) : ∀ {b c : Int}, c ∣ b → (a * b) / c = a * (b / c)",
"start": [
608,
1
],
"end": [
611,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_assoc'",
"code": "protected theorem mul_ediv_assoc' (b : Int) {a c : Int}\n (h : c ∣ a) : (a * b) / c = a / c * b",
"start": [
613,
1
],
"end": [
615,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_ediv_of_dvd",
"code": "theorem neg_ediv_of_dvd : ∀ {a b : Int}, b ∣ a → (-a) / b = -(a / b)",
"start": [
617,
1
],
"end": [
621,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_ediv_of_dvd",
"code": "theorem sub_ediv_of_dvd (a : Int) {b c : Int}\n (hcb : c ∣ b) : (a - b) / c = a / c - b / c",
"start": [
623,
1
],
"end": [
626,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_one",
"code": "@[simp] theorem ediv_one : ∀ a : Int, a / 1 = a",
"start": [
628,
1
],
"end": [
630,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_one",
"code": "@[simp] theorem emod_one (a : Int) : a % 1 = 0",
"start": [
632,
1
],
"end": [
633,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_self",
"code": "@[simp] protected theorem ediv_self {a : Int} (H : a ≠ 0) : a / a = 1",
"start": [
635,
1
],
"end": [
636,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_sub_cancel",
"code": "@[simp]\ntheorem emod_sub_cancel (x y : Int): (x - y)%y = x%y",
"start": [
638,
1
],
"end": [
643,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_sub_of_emod_eq",
"code": "theorem dvd_sub_of_emod_eq {a b c : Int} (h : a % b = c) : b ∣ a - c",
"start": [
645,
1
],
"end": [
650,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_mul_cancel",
"code": "protected theorem ediv_mul_cancel {a b : Int} (H : b ∣ a) : a / b * b = a",
"start": [
652,
1
],
"end": [
653,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_ediv_cancel'",
"code": "protected theorem mul_ediv_cancel' {a b : Int} (H : a ∣ b) : a * (b / a) = b",
"start": [
655,
1
],
"end": [
656,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_mul_of_ediv_eq_right",
"code": "protected theorem eq_mul_of_ediv_eq_right {a b c : Int}\n (H1 : b ∣ a) (H2 : a / b = c) : a = b * c",
"start": [
658,
1
],
"end": [
659,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_iff_eq_mul_right",
"code": "protected theorem ediv_eq_iff_eq_mul_right {a b c : Int}\n (H : b ≠ 0) (H' : b ∣ a) : a / b = c ↔ a = b * c",
"start": [
661,
1
],
"end": [
663,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_iff_eq_mul_left",
"code": "protected theorem ediv_eq_iff_eq_mul_left {a b c : Int}\n (H : b ≠ 0) (H' : b ∣ a) : a / b = c ↔ a = c * b",
"start": [
665,
1
],
"end": [
667,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_mul_of_ediv_eq_left",
"code": "protected theorem eq_mul_of_ediv_eq_left {a b c : Int}\n (H1 : b ∣ a) (H2 : a / b = c) : a = c * b",
"start": [
669,
1
],
"end": [
671,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_zero_of_ediv_eq_zero",
"code": "protected theorem eq_zero_of_ediv_eq_zero {d n : Int} (h : d ∣ n) (H : n / d = 0) : n = 0",
"start": [
673,
1
],
"end": [
674,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sub_ediv_of_dvd_sub",
"code": "theorem sub_ediv_of_dvd_sub {a b c : Int}\n (hcab : c ∣ a - b) : (a - b) / c = a / c - b / c",
"start": [
676,
1
],
"end": [
678,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_left_inj",
"code": "@[simp] protected theorem ediv_left_inj {a b d : Int}\n (hda : d ∣ a) (hdb : d ∣ b) : a / d = b / d ↔ a = b",
"start": [
680,
1
],
"end": [
683,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_sign",
"code": "theorem ediv_sign : ∀ a b, a / sign b = a * sign b",
"start": [
685,
1
],
"end": [
688,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_mul_le",
"code": "protected theorem ediv_mul_le (a : Int) {b : Int} (H : b ≠ 0) : a / b * b ≤ a",
"start": [
692,
1
],
"end": [
693,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_mul_le_mul_left",
"code": "theorem le_of_mul_le_mul_left {a b c : Int} (w : a * b ≤ a * c) (h : 0 < a) : b ≤ c",
"start": [
695,
1
],
"end": [
700,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_of_mul_le_mul_right",
"code": "theorem le_of_mul_le_mul_right {a b c : Int} (w : b * a ≤ c * a) (h : 0 < a) : b ≤ c",
"start": [
702,
1
],
"end": [
704,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_le_of_le_mul",
"code": "protected theorem ediv_le_of_le_mul {a b c : Int} (H : 0 < c) (H' : a ≤ b * c) : a / c ≤ b",
"start": [
706,
1
],
"end": [
707,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_lt_of_lt_ediv",
"code": "protected theorem mul_lt_of_lt_ediv {a b c : Int} (H : 0 < c) (H3 : a < b / c) : a * c < b",
"start": [
709,
1
],
"end": [
710,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_le_of_le_ediv",
"code": "protected theorem mul_le_of_le_ediv {a b c : Int} (H1 : 0 < c) (H2 : a ≤ b / c) : a * c ≤ b",
"start": [
712,
1
],
"end": [
714,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_lt_of_lt_mul",
"code": "protected theorem ediv_lt_of_lt_mul {a b c : Int} (H : 0 < c) (H' : a < b * c) : a / c < b",
"start": [
716,
1
],
"end": [
717,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_mul_lt_mul_left",
"code": "theorem lt_of_mul_lt_mul_left {a b c : Int} (w : a * b < a * c) (h : 0 ≤ a) : b < c",
"start": [
719,
1
],
"end": [
727,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_of_mul_lt_mul_right",
"code": "theorem lt_of_mul_lt_mul_right {a b c : Int} (w : b * a < c * a) (h : 0 ≤ a) : b < c",
"start": [
729,
1
],
"end": [
731,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_ediv_of_mul_le",
"code": "protected theorem le_ediv_of_mul_le {a b c : Int} (H1 : 0 < c) (H2 : a * c ≤ b) : a ≤ b / c",
"start": [
733,
1
],
"end": [
735,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_ediv_iff_mul_le",
"code": "protected theorem le_ediv_iff_mul_le {a b c : Int} (H : 0 < c) : a ≤ b / c ↔ a * c ≤ b",
"start": [
737,
1
],
"end": [
738,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_le_ediv",
"code": "protected theorem ediv_le_ediv {a b c : Int} (H : 0 < c) (H' : a ≤ b) : a / c ≤ b / c",
"start": [
740,
1
],
"end": [
741,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_mul_of_ediv_lt",
"code": "protected theorem lt_mul_of_ediv_lt {a b c : Int} (H1 : 0 < c) (H2 : a / c < b) : a < b * c",
"start": [
743,
1
],
"end": [
744,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_lt_iff_lt_mul",
"code": "protected theorem ediv_lt_iff_lt_mul {a b c : Int} (H : 0 < c) : a / c < b ↔ a < b * c",
"start": [
746,
1
],
"end": [
747,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_mul_of_ediv_le",
"code": "protected theorem le_mul_of_ediv_le {a b c : Int} (H1 : 0 ≤ b) (H2 : b ∣ a) (H3 : a / b ≤ c) :\n a ≤ c * b",
"start": [
749,
1
],
"end": [
751,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_ediv_of_mul_lt",
"code": "protected theorem lt_ediv_of_mul_lt {a b c : Int} (H1 : 0 ≤ b) (H2 : b ∣ c) (H3 : a * b < c) :\n a < c / b",
"start": [
753,
1
],
"end": [
755,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_ediv_iff_mul_lt",
"code": "protected theorem lt_ediv_iff_mul_lt {a b : Int} (c : Int) (H : 0 < c) (H' : c ∣ b) :\n a < b / c ↔ a * c < b",
"start": [
757,
1
],
"end": [
759,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_pos_of_pos_of_dvd",
"code": "theorem ediv_pos_of_pos_of_dvd {a b : Int} (H1 : 0 < a) (H2 : 0 ≤ b) (H3 : b ∣ a) : 0 < a / b",
"start": [
761,
1
],
"end": [
762,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ediv_eq_ediv_of_mul_eq_mul",
"code": "theorem ediv_eq_ediv_of_mul_eq_mul {a b c d : Int}\n (H2 : d ∣ c) (H3 : b ≠ 0) (H4 : d ≠ 0) (H5 : a * d = b * c) : a / b = c / d",
"start": [
764,
1
],
"end": [
767,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_one",
"code": "@[simp] protected theorem div_one : ∀ a : Int, a.div 1 = a",
"start": [
771,
1
],
"end": [
773,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_neg",
"code": "@[simp] protected theorem div_neg : ∀ a b : Int, a.div (-b) = -(a.div b)",
"start": [
776,
1
],
"end": [
779,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_div",
"code": "@[simp] protected theorem neg_div : ∀ a b : Int, (-a).div b = -(a.div b)",
"start": [
782,
1
],
"end": [
785,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.neg_div_neg",
"code": "protected theorem neg_div_neg (a b : Int) : (-a).div (-b) = a.div b",
"start": [
787,
1
],
"end": [
788,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_nonneg",
"code": "protected theorem div_nonneg {a b : Int} (Ha : 0 ≤ a) (Hb : 0 ≤ b) : 0 ≤ a.div b",
"start": [
790,
1
],
"end": [
792,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_nonpos",
"code": "protected theorem div_nonpos {a b : Int} (Ha : 0 ≤ a) (Hb : b ≤ 0) : a.div b ≤ 0",
"start": [
794,
1
],
"end": [
795,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_zero_of_lt",
"code": "theorem div_eq_zero_of_lt {a b : Int} (H1 : 0 ≤ a) (H2 : a < b) : a.div b = 0",
"start": [
797,
1
],
"end": [
799,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_cancel",
"code": "@[simp] protected theorem mul_div_cancel (a : Int) {b : Int} (H : b ≠ 0) : (a * b).div b = a",
"start": [
801,
1
],
"end": [
812,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_cancel_left",
"code": "@[simp] protected theorem mul_div_cancel_left (b : Int) (H : a ≠ 0) : (a * b).div a = b",
"start": [
814,
1
],
"end": [
815,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_self",
"code": "@[simp] protected theorem div_self {a : Int} (H : a ≠ 0) : a.div a = 1",
"start": [
817,
1
],
"end": [
818,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_cancel_of_mod_eq_zero",
"code": "theorem mul_div_cancel_of_mod_eq_zero {a b : Int} (H : a.mod b = 0) : b * (a.div b) = a",
"start": [
820,
1
],
"end": [
821,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_mul_cancel_of_mod_eq_zero",
"code": "theorem div_mul_cancel_of_mod_eq_zero {a b : Int} (H : a.mod b = 0) : a.div b * b = a",
"start": [
823,
1
],
"end": [
824,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_of_mod_eq_zero",
"code": "theorem dvd_of_mod_eq_zero {a b : Int} (H : mod b a = 0) : a ∣ b",
"start": [
826,
1
],
"end": [
827,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_assoc",
"code": "protected theorem mul_div_assoc (a : Int) : ∀ {b c : Int}, c ∣ b → (a * b).div c = a * (b.div c)",
"start": [
829,
1
],
"end": [
832,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_assoc'",
"code": "protected theorem mul_div_assoc' (b : Int) {a c : Int} (h : c ∣ a) :\n (a * b).div c = a.div c * b",
"start": [
834,
1
],
"end": [
836,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_dvd_div",
"code": "theorem div_dvd_div : ∀ {a b c : Int}, a ∣ b → b ∣ c → b.div a ∣ c.div a",
"start": [
838,
1
],
"end": [
843,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.natAbs_div",
"code": "@[simp] theorem natAbs_div (a b : Int) : natAbs (a.div b) = (natAbs a).div (natAbs b)",
"start": [
845,
1
],
"end": [
850,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_of_eq_mul_right",
"code": "protected theorem div_eq_of_eq_mul_right {a b c : Int}\n (H1 : b ≠ 0) (H2 : a = b * c) : a.div b = c",
"start": [
852,
1
],
"end": [
853,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_div_of_mul_eq_right",
"code": "protected theorem eq_div_of_mul_eq_right {a b c : Int}\n (H1 : a ≠ 0) (H2 : a * b = c) : b = c.div a",
"start": [
855,
1
],
"end": [
857,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_mod",
"code": "theorem ofNat_mod (m n : Nat) : (↑(m % n) : Int) = mod m n",
"start": [
861,
1
],
"end": [
861,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_one",
"code": "@[simp] theorem mod_one (a : Int) : mod a 1 = 0",
"start": [
863,
1
],
"end": [
864,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_eq_of_lt",
"code": "theorem mod_eq_of_lt {a b : Int} (H1 : 0 ≤ a) (H2 : a < b) : mod a b = a",
"start": [
866,
1
],
"end": [
867,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_lt_of_pos",
"code": "theorem mod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) : mod a b < b",
"start": [
869,
1
],
"end": [
873,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_nonneg",
"code": "theorem mod_nonneg : ∀ {a : Int} (b : Int), 0 ≤ a → 0 ≤ mod a b",
"start": [
875,
1
],
"end": [
876,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_neg",
"code": "@[simp] theorem mod_neg (a b : Int) : mod a (-b) = mod a b",
"start": [
878,
1
],
"end": [
879,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_mod_left",
"code": "@[simp] theorem mul_mod_left (a b : Int) : (a * b).mod b = 0",
"start": [
881,
1
],
"end": [
883,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_mod_right",
"code": "@[simp] theorem mul_mod_right (a b : Int) : (a * b).mod a = 0",
"start": [
885,
1
],
"end": [
886,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_eq_zero_of_dvd",
"code": "theorem mod_eq_zero_of_dvd : ∀ {a b : Int}, a ∣ b → mod b a = 0",
"start": [
888,
1
],
"end": [
889,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_iff_mod_eq_zero",
"code": "theorem dvd_iff_mod_eq_zero (a b : Int) : a ∣ b ↔ mod b a = 0",
"start": [
891,
1
],
"end": [
892,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_mul_cancel",
"code": "protected theorem div_mul_cancel {a b : Int} (H : b ∣ a) : a.div b * b = a",
"start": [
894,
1
],
"end": [
895,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_div_cancel'",
"code": "protected theorem mul_div_cancel' {a b : Int} (H : a ∣ b) : a * b.div a = b",
"start": [
897,
1
],
"end": [
898,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_mul_of_div_eq_right",
"code": "protected theorem eq_mul_of_div_eq_right {a b c : Int}\n (H1 : b ∣ a) (H2 : a.div b = c) : a = b * c",
"start": [
900,
1
],
"end": [
901,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mod_self",
"code": "@[simp] theorem mod_self {a : Int} : a.mod a = 0",
"start": [
903,
1
],
"end": [
904,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_div_add_one_mul_self",
"code": "theorem lt_div_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) : a < (a.div b + 1) * b",
"start": [
906,
1
],
"end": [
908,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_iff_eq_mul_right",
"code": "protected theorem div_eq_iff_eq_mul_right {a b c : Int}\n (H : b ≠ 0) (H' : b ∣ a) : a.div b = c ↔ a = b * c",
"start": [
910,
1
],
"end": [
912,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_iff_eq_mul_left",
"code": "protected theorem div_eq_iff_eq_mul_left {a b c : Int}\n (H : b ≠ 0) (H' : b ∣ a) : a.div b = c ↔ a = c * b",
"start": [
914,
1
],
"end": [
916,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_mul_of_div_eq_left",
"code": "protected theorem eq_mul_of_div_eq_left {a b c : Int}\n (H1 : b ∣ a) (H2 : a.div b = c) : a = c * b",
"start": [
918,
1
],
"end": [
920,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_of_eq_mul_left",
"code": "protected theorem div_eq_of_eq_mul_left {a b c : Int}\n (H1 : b ≠ 0) (H2 : a = c * b) : a.div b = c",
"start": [
922,
1
],
"end": [
924,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.eq_zero_of_div_eq_zero",
"code": "protected theorem eq_zero_of_div_eq_zero {d n : Int} (h : d ∣ n) (H : n.div d = 0) : n = 0",
"start": [
926,
1
],
"end": [
927,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_left_inj",
"code": "@[simp] protected theorem div_left_inj {a b d : Int}\n (hda : d ∣ a) (hdb : d ∣ b) : a.div d = b.div d ↔ a = b",
"start": [
929,
1
],
"end": [
932,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_sign",
"code": "theorem div_sign : ∀ a b, a.div (sign b) = a * sign b",
"start": [
934,
1
],
"end": [
937,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.sign_eq_div_abs",
"code": "protected theorem sign_eq_div_abs (a : Int) : sign a = a.div (natAbs a)",
"start": [
939,
1
],
"end": [
942,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_nonneg",
"code": "theorem fdiv_nonneg {a b : Int} (Ha : 0 ≤ a) (Hb : 0 ≤ b) : 0 ≤ a.fdiv b",
"start": [
946,
1
],
"end": [
948,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_nonpos",
"code": "theorem fdiv_nonpos : ∀ {a b : Int}, 0 ≤ a → b ≤ 0 → a.fdiv b ≤ 0",
"start": [
951,
1
],
"end": [
952,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_neg'",
"code": "theorem fdiv_neg' : ∀ {a b : Int}, a < 0 → 0 < b → a.fdiv b < 0",
"start": [
954,
1
],
"end": [
955,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_one",
"code": "@[simp] theorem fdiv_one : ∀ a : Int, a.fdiv 1 = a",
"start": [
957,
1
],
"end": [
960,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_fdiv_cancel",
"code": "@[simp] theorem mul_fdiv_cancel (a : Int) {b : Int} (H : b ≠ 0) : fdiv (a * b) b = a",
"start": [
962,
1
],
"end": [
971,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_fdiv_cancel_left",
"code": "@[simp] theorem mul_fdiv_cancel_left (b : Int) (H : a ≠ 0) : fdiv (a * b) a = b",
"start": [
973,
1
],
"end": [
974,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_self",
"code": "@[simp] protected theorem fdiv_self {a : Int} (H : a ≠ 0) : a.fdiv a = 1",
"start": [
976,
1
],
"end": [
977,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.lt_fdiv_add_one_mul_self",
"code": "theorem lt_fdiv_add_one_mul_self (a : Int) {b : Int} (H : 0 < b) : a < (a.fdiv b + 1) * b",
"start": [
979,
1
],
"end": [
980,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.ofNat_fmod",
"code": "theorem ofNat_fmod (m n : Nat) : ↑(m % n) = fmod m n",
"start": [
984,
1
],
"end": [
985,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_one",
"code": "@[simp] theorem fmod_one (a : Int) : a.fmod 1 = 0",
"start": [
987,
1
],
"end": [
988,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_eq_of_lt",
"code": "theorem fmod_eq_of_lt {a b : Int} (H1 : 0 ≤ a) (H2 : a < b) : a.fmod b = a",
"start": [
990,
1
],
"end": [
991,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_nonneg",
"code": "theorem fmod_nonneg {a b : Int} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a.fmod b",
"start": [
993,
1
],
"end": [
994,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_nonneg'",
"code": "theorem fmod_nonneg' (a : Int) {b : Int} (hb : 0 < b) : 0 ≤ a.fmod b",
"start": [
996,
1
],
"end": [
997,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_lt_of_pos",
"code": "theorem fmod_lt_of_pos (a : Int) {b : Int} (H : 0 < b) : a.fmod b < b",
"start": [
999,
1
],
"end": [
1000,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_fmod_left",
"code": "@[simp] theorem mul_fmod_left (a b : Int) : (a * b).fmod b = 0",
"start": [
1002,
1
],
"end": [
1004,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_fmod_right",
"code": "@[simp] theorem mul_fmod_right (a b : Int) : (a * b).fmod a = 0",
"start": [
1006,
1
],
"end": [
1007,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fmod_self",
"code": "@[simp] theorem fmod_self {a : Int} : a.fmod a = 0",
"start": [
1009,
1
],
"end": [
1010,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.div_eq_ediv_of_dvd",
"code": "theorem div_eq_ediv_of_dvd {a b : Int} (h : b ∣ a) : a.div b = a / b",
"start": [
1014,
1
],
"end": [
1017,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.fdiv_eq_ediv_of_dvd",
"code": "theorem fdiv_eq_ediv_of_dvd : ∀ {a b : Int}, b ∣ a → a.fdiv b = a / b",
"start": [
1019,
1
],
"end": [
1023,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_emod",
"code": "@[simp] theorem bmod_emod : bmod x m % m = x % m",
"start": [
1027,
1
],
"end": [
1029,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_bmod_congr",
"code": "@[simp]\ntheorem emod_bmod_congr (x : Int) (n : Nat) : Int.bmod (x%n) n = Int.bmod x n",
"start": [
1031,
1
],
"end": [
1033,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_def",
"code": "theorem bmod_def (x : Int) (m : Nat) : bmod x m =\n if (x % m) < (m + 1) / 2 then\n x % m\n else\n (x % m) - m",
"start": [
1035,
1
],
"end": [
1040,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_pos",
"code": "theorem bmod_pos (x : Int) (m : Nat) (p : x % m < (m + 1) / 2) : bmod x m = x % m",
"start": [
1042,
1
],
"end": [
1043,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_neg",
"code": "theorem bmod_neg (x : Int) (m : Nat) (p : x % m ≥ (m + 1) / 2) : bmod x m = (x % m) - m",
"start": [
1045,
1
],
"end": [
1046,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_one_is_zero",
"code": "@[simp]\ntheorem bmod_one_is_zero (x : Int) : Int.bmod x 1 = 0",
"start": [
1048,
1
],
"end": [
1050,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_add_cancel",
"code": "@[simp]\ntheorem bmod_add_cancel (x : Int) (n : Nat) : Int.bmod (x + n) n = Int.bmod x n",
"start": [
1052,
1
],
"end": [
1054,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_add_mul_cancel",
"code": "@[simp]\ntheorem bmod_add_mul_cancel (x : Int) (n : Nat) (k : Int) : Int.bmod (x + n * k) n = Int.bmod x n",
"start": [
1056,
1
],
"end": [
1058,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_sub_cancel",
"code": "@[simp]\ntheorem bmod_sub_cancel (x : Int) (n : Nat) : Int.bmod (x - n) n = Int.bmod x n",
"start": [
1060,
1
],
"end": [
1062,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_add_bmod_congr",
"code": "@[simp]\ntheorem emod_add_bmod_congr (x : Int) (n : Nat) : Int.bmod (x%n + y) n = Int.bmod (x + y) n",
"start": [
1064,
1
],
"end": [
1067,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_mul_bmod_congr",
"code": "@[simp]\ntheorem emod_mul_bmod_congr (x : Int) (n : Nat) : Int.bmod (x%n * y) n = Int.bmod (x * y) n",
"start": [
1069,
1
],
"end": [
1072,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_add_bmod_congr",
"code": "@[simp]\ntheorem bmod_add_bmod_congr : Int.bmod (Int.bmod x n + y) n = Int.bmod (x + y) n",
"start": [
1074,
1
],
"end": [
1082,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_bmod_bmod",
"code": "@[simp] theorem add_bmod_bmod : Int.bmod (x + Int.bmod y n) n = Int.bmod (x + y) n",
"start": [
1084,
1
],
"end": [
1085,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_mul_bmod",
"code": "@[simp]\ntheorem bmod_mul_bmod : Int.bmod (Int.bmod x n * y) n = Int.bmod (x * y) n",
"start": [
1087,
1
],
"end": [
1095,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.mul_bmod_bmod",
"code": "@[simp] theorem mul_bmod_bmod : Int.bmod (x * Int.bmod y n) n = Int.bmod (x * y) n",
"start": [
1097,
1
],
"end": [
1098,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.add_bmod",
"code": "theorem add_bmod (a b : Int) (n : Nat) : (a + b).bmod n = (a.bmod n + b.bmod n).bmod n",
"start": [
1100,
1
],
"end": [
1101,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.emod_bmod",
"code": "theorem emod_bmod {x : Int} {m : Nat} : bmod (x % m) m = bmod x m",
"start": [
1103,
1
],
"end": [
1104,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_bmod",
"code": "@[simp] theorem bmod_bmod : bmod (bmod x m) m = bmod x m",
"start": [
1106,
1
],
"end": [
1108,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_zero",
"code": "@[simp] theorem bmod_zero : Int.bmod 0 m = 0",
"start": [
1110,
1
],
"end": [
1123,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.dvd_bmod_sub_self",
"code": "theorem dvd_bmod_sub_self {x : Int} {m : Nat} : (m : Int) ∣ bmod x m - x",
"start": [
1125,
1
],
"end": [
1130,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.le_bmod",
"code": "theorem le_bmod {x : Int} {m : Nat} (h : 0 < m) : - (m/2) ≤ Int.bmod x m",
"start": [
1132,
1
],
"end": [
1163,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_lt",
"code": "theorem bmod_lt {x : Int} {m : Nat} (h : 0 < m) : bmod x m < (m + 1) / 2",
"start": [
1165,
1
],
"end": [
1173,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_le",
"code": "theorem bmod_le {x : Int} {m : Nat} (h : 0 < m) : bmod x m ≤ (m - 1) / 2",
"start": [
1175,
1
],
"end": [
1186,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Int.bmod_natAbs_plus_one",
"code": "theorem bmod_natAbs_plus_one (x : Int) (w : 1 < x.natAbs) : bmod x (x.natAbs + 1) = - x.sign",
"start": [
1189,
1
],
"end": [
1229,
35
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/List/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Option/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/List/BasicAux.lean",
".lake/packages/lean4/src/lean/Init/Data/List/Control.lean",
".lake/packages/lean4/src/lean/Init/Data/Bool.lean",
".lake/packages/lean4/src/lean/Init/Hints.lean",
".lake/packages/lean4/src/lean/Init/Control/Lawful/Basic.lean",
".lake/packages/lean4/src/lean/Init/PropLemmas.lean"
] | [
{
"full_name": "List.cons_ne_nil",
"code": "theorem cons_ne_nil (a : α) (l : List α) : a :: l ≠ []",
"start": [
71,
1
],
"end": [
71,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_ne_self",
"code": "@[simp]\ntheorem cons_ne_self (a : α) (l : List α) : a :: l ≠ l",
"start": [
73,
1
],
"end": [
74,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head_eq_of_cons_eq",
"code": "theorem head_eq_of_cons_eq (H : h₁ :: t₁ = h₂ :: t₂) : h₁ = h₂",
"start": [
76,
1
],
"end": [
76,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail_eq_of_cons_eq",
"code": "theorem tail_eq_of_cons_eq (H : h₁ :: t₁ = h₂ :: t₂) : t₁ = t₂",
"start": [
78,
1
],
"end": [
78,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_inj_right",
"code": "theorem cons_inj_right (a : α) {l l' : List α} : a :: l = a :: l' ↔ l = l'",
"start": [
80,
1
],
"end": [
81,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_inj",
"code": "@[deprecated (since := \"2024-06-15\")] abbrev cons_inj := @cons_inj_right",
"start": [
83,
1
],
"end": [
83,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_eq_cons",
"code": "theorem cons_eq_cons {a b : α} {l l' : List α} : a :: l = b :: l' ↔ a = b ∧ l = l'",
"start": [
85,
1
],
"end": [
86,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_cons_of_ne_nil",
"code": "theorem exists_cons_of_ne_nil : ∀ {l : List α}, l ≠ [] → ∃ b L, l = b :: L",
"start": [
88,
1
],
"end": [
89,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_nil_of_length_eq_zero",
"code": "theorem eq_nil_of_length_eq_zero (_ : length l = 0) : l = []",
"start": [
93,
1
],
"end": [
93,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_nil_of_length_eq_add_one",
"code": "theorem ne_nil_of_length_eq_add_one (_ : length l = n + 1) : l ≠ []",
"start": [
95,
1
],
"end": [
95,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_nil_of_length_eq_succ",
"code": "@[deprecated ne_nil_of_length_eq_add_one (since := \"2024-06-16\")]\nabbrev ne_nil_of_length_eq_succ := @ne_nil_of_length_eq_add_one",
"start": [
97,
1
],
"end": [
98,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_eq_zero",
"code": "@[simp] theorem length_eq_zero : length l = 0 ↔ l = []",
"start": [
100,
1
],
"end": [
101,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_pos_of_mem",
"code": "theorem length_pos_of_mem {a : α} : ∀ {l : List α}, a ∈ l → 0 < length l",
"start": [
103,
1
],
"end": [
104,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_mem_of_length_pos",
"code": "theorem exists_mem_of_length_pos : ∀ {l : List α}, 0 < length l → ∃ a, a ∈ l",
"start": [
106,
1
],
"end": [
107,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_pos_iff_exists_mem",
"code": "theorem length_pos_iff_exists_mem {l : List α} : 0 < length l ↔ ∃ a, a ∈ l",
"start": [
109,
1
],
"end": [
110,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_cons_of_length_pos",
"code": "theorem exists_cons_of_length_pos : ∀ {l : List α}, 0 < l.length → ∃ h t, l = h :: t",
"start": [
112,
1
],
"end": [
113,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_pos_iff_exists_cons",
"code": "theorem length_pos_iff_exists_cons :\n ∀ {l : List α}, 0 < l.length ↔ ∃ h t, l = h :: t",
"start": [
115,
1
],
"end": [
117,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_cons_of_length_eq_add_one",
"code": "theorem exists_cons_of_length_eq_add_one :\n ∀ {l : List α}, l.length = n + 1 → ∃ h t, l = h :: t",
"start": [
119,
1
],
"end": [
121,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_pos",
"code": "theorem length_pos {l : List α} : 0 < length l ↔ l ≠ []",
"start": [
123,
1
],
"end": [
124,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_eq_one",
"code": "theorem length_eq_one {l : List α} : length l = 1 ↔ ∃ a, l = [a]",
"start": [
126,
1
],
"end": [
127,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_zero",
"code": "@[simp] theorem get_cons_zero : get (a::l) (0 : Fin (l.length + 1)) = a",
"start": [
131,
1
],
"end": [
131,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_succ",
"code": "@[simp] theorem get_cons_succ {as : List α} {h : i + 1 < (a :: as).length} :\n (a :: as).get ⟨i+1, h⟩ = as.get ⟨i, Nat.lt_of_succ_lt_succ h⟩",
"start": [
133,
1
],
"end": [
134,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_succ'",
"code": "@[simp] theorem get_cons_succ' {as : List α} {i : Fin as.length} :\n (a :: as).get i.succ = as.get i",
"start": [
136,
1
],
"end": [
137,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_len_le",
"code": "theorem get?_len_le : ∀ {l : List α} {n}, length l ≤ n → l.get? n = none",
"start": [
139,
1
],
"end": [
141,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_eq_get",
"code": "theorem get?_eq_get : ∀ {l : List α} {n} (h : n < l.length), l.get? n = some (get l ⟨n, h⟩)",
"start": [
143,
1
],
"end": [
145,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_eq_some",
"code": "theorem get?_eq_some : l.get? n = some a ↔ ∃ h, get l ⟨n, h⟩ = a",
"start": [
147,
1
],
"end": [
151,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_eq_none",
"code": "theorem get?_eq_none : l.get? n = none ↔ length l ≤ n",
"start": [
153,
1
],
"end": [
154,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_eq_getElem?",
"code": "@[simp] theorem get?_eq_getElem? (l : List α) (i : Nat) : l.get? i = l[i]?",
"start": [
156,
1
],
"end": [
159,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_eq_getElem",
"code": "@[simp] theorem get_eq_getElem (l : List α) (i : Fin l.length) : l.get i = l[i.1]'i.2",
"start": [
161,
1
],
"end": [
161,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_nil",
"code": "@[simp] theorem getElem?_nil {n : Nat} : ([] : List α)[n]? = none",
"start": [
163,
1
],
"end": [
163,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_cons_zero",
"code": "@[simp] theorem getElem?_cons_zero {l : List α} : (a::l)[0]? = some a",
"start": [
165,
1
],
"end": [
167,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_cons_succ",
"code": "@[simp] theorem getElem?_cons_succ {l : List α} : (a::l)[n+1]? = l[n]?",
"start": [
169,
1
],
"end": [
171,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_len_le",
"code": "theorem getElem?_len_le : ∀ {l : List α} {n}, length l ≤ n → l[n]? = none",
"start": [
173,
1
],
"end": [
176,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_eq_getElem",
"code": "@[simp] theorem getElem?_eq_getElem {l : List α} {n} (h : n < l.length) : l[n]? = some l[n]",
"start": [
178,
1
],
"end": [
179,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_eq_some",
"code": "theorem getElem?_eq_some {l : List α} : l[n]? = some a ↔ ∃ h : n < l.length, l[n] = a",
"start": [
181,
1
],
"end": [
182,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_eq_none_iff",
"code": "@[simp] theorem getElem?_eq_none_iff : l[n]? = none ↔ length l ≤ n",
"start": [
184,
1
],
"end": [
185,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_eq_none",
"code": "theorem getElem?_eq_none (h : length l ≤ n) : l[n]? = none",
"start": [
187,
1
],
"end": [
187,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem!_nil",
"code": "@[simp] theorem getElem!_nil [Inhabited α] {n : Nat} : ([] : List α)[n]! = default",
"start": [
189,
1
],
"end": [
189,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem!_cons_zero",
"code": "@[simp] theorem getElem!_cons_zero [Inhabited α] {l : List α} : (a::l)[0]! = a",
"start": [
191,
1
],
"end": [
192,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem!_cons_succ",
"code": "@[simp] theorem getElem!_cons_succ [Inhabited α] {l : List α} : (a::l)[n+1]! = l[n]!",
"start": [
194,
1
],
"end": [
197,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_cons_one",
"code": "@[simp] theorem get_cons_cons_one : (a₁ :: a₂ :: as).get (1 : Fin (as.length + 2)) = a₂",
"start": [
199,
1
],
"end": [
199,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_len_le",
"code": "theorem get!_len_le [Inhabited α] : ∀ {l : List α} {n}, length l ≤ n → l.get! n = (default : α)",
"start": [
201,
1
],
"end": [
203,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_zero",
"code": "theorem get?_zero (l : List α) : l.get? 0 = l.head?",
"start": [
205,
1
],
"end": [
205,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_of_eq",
"code": "theorem getElem_of_eq {l l' : List α} (h : l = l') {i : Nat} (w : i < l.length) :\n l[i] = l'[i]'(h ▸ w)",
"start": [
207,
1
],
"end": [
214,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_of_eq",
"code": "theorem get_of_eq {l l' : List α} (h : l = l') (i : Fin l.length) :\n get l i = get l' ⟨i, h ▸ i.2⟩",
"start": [
216,
1
],
"end": [
223,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_singleton",
"code": "@[simp] theorem getElem_singleton (a : α) (h : i < 1) : [a][i] = a",
"start": [
225,
1
],
"end": [
227,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_singleton",
"code": "@[deprecated getElem_singleton (since := \"2024-06-12\")]\ntheorem get_singleton (a : α) (n : Fin 1) : get [a] n = a",
"start": [
229,
1
],
"end": [
230,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_zero",
"code": "theorem getElem_zero {l : List α} (h : 0 < l.length) : l[0] = l.head (length_pos.mp h)",
"start": [
232,
1
],
"end": [
234,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_mk_zero",
"code": "theorem get_mk_zero : ∀ {l : List α} (h : 0 < l.length), l.get ⟨0, h⟩ = l.head (length_pos.mp h)",
"start": [
236,
1
],
"end": [
237,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem!_of_getElem?",
"code": "theorem getElem!_of_getElem? [Inhabited α] : ∀ {l : List α} {n : Nat}, l[n]? = some a → l[n]! = a",
"start": [
239,
1
],
"end": [
244,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_of_get?",
"code": "theorem get!_of_get? [Inhabited α] : ∀ {l : List α} {n}, get? l n = some a → get! l n = a",
"start": [
246,
1
],
"end": [
248,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get!_eq_getD",
"code": "@[simp] theorem get!_eq_getD [Inhabited α] : ∀ (l : List α) n, l.get! n = l.getD n default",
"start": [
250,
1
],
"end": [
253,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ext_getElem?",
"code": "@[ext] theorem ext_getElem? {l₁ l₂ : List α} (h : ∀ n : Nat, l₁[n]? = l₂[n]?) : l₁ = l₂",
"start": [
255,
1
],
"end": [
256,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ext_getElem",
"code": "theorem ext_getElem {l₁ l₂ : List α} (hl : length l₁ = length l₂)\n (h : ∀ (n : Nat) (h₁ : n < l₁.length) (h₂ : n < l₂.length), l₁[n]'h₁ = l₂[n]'h₂) : l₁ = l₂",
"start": [
258,
1
],
"end": [
265,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ext_get",
"code": "theorem ext_get {l₁ l₂ : List α} (hl : length l₁ = length l₂)\n (h : ∀ n h₁ h₂, get l₁ ⟨n, h₁⟩ = get l₂ ⟨n, h₂⟩) : l₁ = l₂",
"start": [
267,
1
],
"end": [
269,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_concat_length",
"code": "@[simp] theorem getElem_concat_length : ∀ (l : List α) (a : α) (i) (_ : i = l.length) (w), (l ++ [a])[i]'w = a",
"start": [
271,
1
],
"end": [
273,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_concat_length",
"code": "theorem getElem?_concat_length (l : List α) (a : α) : (l ++ [a])[l.length]? = some a",
"start": [
275,
1
],
"end": [
276,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_concat_length",
"code": "@[deprecated getElem?_concat_length (since := \"2024-06-12\")]\ntheorem get?_concat_length (l : List α) (a : α) : (l ++ [a]).get? l.length = some a",
"start": [
278,
1
],
"end": [
279,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_mem_nil",
"code": "@[simp] theorem not_mem_nil (a : α) : ¬ a ∈ []",
"start": [
283,
1
],
"end": [
283,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_cons",
"code": "@[simp] theorem mem_cons : a ∈ (b :: l) ↔ a = b ∨ a ∈ l",
"start": [
285,
1
],
"end": [
287,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_cons_self",
"code": "theorem mem_cons_self (a : α) (l : List α) : a ∈ a :: l",
"start": [
289,
1
],
"end": [
289,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_cons_of_mem",
"code": "theorem mem_cons_of_mem (y : α) {a : α} {l : List α} : a ∈ l → a ∈ y :: l",
"start": [
291,
1
],
"end": [
291,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_mem_of_ne_nil",
"code": "theorem exists_mem_of_ne_nil (l : List α) (h : l ≠ []) : ∃ x, x ∈ l",
"start": [
293,
1
],
"end": [
294,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_nil_iff_forall_not_mem",
"code": "theorem eq_nil_iff_forall_not_mem {l : List α} : l = [] ↔ ∀ a, a ∉ l",
"start": [
296,
1
],
"end": [
297,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_of_mem_singleton",
"code": "theorem eq_of_mem_singleton : a ∈ [b] → a = b",
"start": [
299,
1
],
"end": [
300,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_singleton",
"code": "@[simp 1100] theorem mem_singleton {a b : α} : a ∈ [b] ↔ a = b",
"start": [
302,
1
],
"end": [
303,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forall_mem_cons",
"code": "theorem forall_mem_cons {p : α → Prop} {a : α} {l : List α} :\n (∀ x, x ∈ a :: l → p x) ↔ p a ∧ ∀ x, x ∈ l → p x",
"start": [
305,
1
],
"end": [
308,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_mem_nil",
"code": "theorem exists_mem_nil (p : α → Prop) : ¬ (∃ x, ∃ _ : x ∈ @nil α, p x)",
"start": [
310,
1
],
"end": [
310,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forall_mem_nil",
"code": "theorem forall_mem_nil (p : α → Prop) : ∀ (x) (_ : x ∈ @nil α), p x",
"start": [
312,
1
],
"end": [
312,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_mem_cons",
"code": "theorem exists_mem_cons {p : α → Prop} {a : α} {l : List α} :\n (∃ x, ∃ _ : x ∈ a :: l, p x) ↔ p a ∨ ∃ x, ∃ _ : x ∈ l, p x",
"start": [
314,
1
],
"end": [
315,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forall_mem_singleton",
"code": "theorem forall_mem_singleton {p : α → Prop} {a : α} : (∀ (x) (_ : x ∈ [a]), p x) ↔ p a",
"start": [
317,
1
],
"end": [
318,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_nil_iff",
"code": "theorem mem_nil_iff (a : α) : a ∈ ([] : List α) ↔ False",
"start": [
320,
1
],
"end": [
320,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_singleton_self",
"code": "theorem mem_singleton_self (a : α) : a ∈ [a]",
"start": [
322,
1
],
"end": [
322,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_of_mem_cons_of_mem",
"code": "theorem mem_of_mem_cons_of_mem : ∀ {a b : α} {l : List α}, a ∈ b :: l → b ∈ l → a ∈ l",
"start": [
324,
1
],
"end": [
325,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_or_ne_mem_of_mem",
"code": "theorem eq_or_ne_mem_of_mem {a b : α} {l : List α} (h' : a ∈ b :: l) : a = b ∨ (a ≠ b ∧ a ∈ l)",
"start": [
327,
1
],
"end": [
328,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_nil_of_mem",
"code": "theorem ne_nil_of_mem {a : α} {l : List α} (h : a ∈ l) : l ≠ []",
"start": [
330,
1
],
"end": [
330,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_iff",
"code": "theorem elem_iff [BEq α] [LawfulBEq α] {a : α} {as : List α} :\n elem a as = true ↔ a ∈ as",
"start": [
332,
1
],
"end": [
333,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_eq_mem",
"code": "@[simp] theorem elem_eq_mem [BEq α] [LawfulBEq α] (a : α) (as : List α) :\n elem a as = decide (a ∈ as)",
"start": [
335,
1
],
"end": [
336,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_of_ne_of_mem",
"code": "theorem mem_of_ne_of_mem {a y : α} {l : List α} (h₁ : a ≠ y) (h₂ : a ∈ y :: l) : a ∈ l",
"start": [
338,
1
],
"end": [
339,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_of_not_mem_cons",
"code": "theorem ne_of_not_mem_cons {a b : α} {l : List α} : a ∉ b::l → a ≠ b",
"start": [
341,
1
],
"end": [
341,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_mem_of_not_mem_cons",
"code": "theorem not_mem_of_not_mem_cons {a b : α} {l : List α} : a ∉ b::l → a ∉ l",
"start": [
343,
1
],
"end": [
343,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_mem_cons_of_ne_of_not_mem",
"code": "theorem not_mem_cons_of_ne_of_not_mem {a y : α} {l : List α} : a ≠ y → a ∉ l → a ∉ y::l",
"start": [
345,
1
],
"end": [
346,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_and_not_mem_of_not_mem_cons",
"code": "theorem ne_and_not_mem_of_not_mem_cons {a y : α} {l : List α} : a ∉ y::l → a ≠ y ∧ a ∉ l",
"start": [
348,
1
],
"end": [
349,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_of_mem",
"code": "theorem getElem_of_mem : ∀ {a} {l : List α}, a ∈ l → ∃ (n : Nat) (h : n < l.length), l[n]'h = a",
"start": [
351,
1
],
"end": [
353,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_of_mem",
"code": "theorem get_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n, get l n = a",
"start": [
355,
1
],
"end": [
357,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_mem",
"code": "theorem getElem_mem : ∀ (l : List α) n (h : n < l.length), l[n]'h ∈ l",
"start": [
359,
1
],
"end": [
361,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_mem",
"code": "theorem get_mem : ∀ (l : List α) n h, get l ⟨n, h⟩ ∈ l",
"start": [
363,
1
],
"end": [
365,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_iff_getElem",
"code": "theorem mem_iff_getElem {a} {l : List α} : a ∈ l ↔ ∃ (n : Nat) (h : n < l.length), l[n]'h = a",
"start": [
367,
1
],
"end": [
368,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_iff_get",
"code": "theorem mem_iff_get {a} {l : List α} : a ∈ l ↔ ∃ n, get l n = a",
"start": [
370,
1
],
"end": [
371,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_of_mem",
"code": "theorem getElem?_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n : Nat, l[n]? = some a",
"start": [
373,
1
],
"end": [
374,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_of_mem",
"code": "theorem get?_of_mem {a} {l : List α} (h : a ∈ l) : ∃ n, l.get? n = some a",
"start": [
376,
1
],
"end": [
377,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_mem",
"code": "theorem getElem?_mem {l : List α} {n : Nat} {a : α} (e : l[n]? = some a) : a ∈ l",
"start": [
379,
1
],
"end": [
380,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_mem",
"code": "theorem get?_mem {l : List α} {n a} (e : l.get? n = some a) : a ∈ l",
"start": [
382,
1
],
"end": [
383,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_iff_getElem?",
"code": "theorem mem_iff_getElem? {a} {l : List α} : a ∈ l ↔ ∃ n : Nat, l[n]? = some a",
"start": [
385,
1
],
"end": [
386,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_iff_get?",
"code": "theorem mem_iff_get? {a} {l : List α} : a ∈ l ↔ ∃ n, l.get? n = some a",
"start": [
388,
1
],
"end": [
389,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.decide_mem_cons",
"code": "@[simp] theorem decide_mem_cons [BEq α] [LawfulBEq α] {l : List α} :\n decide (y ∈ a :: l) = (y == a || decide (y ∈ l))",
"start": [
391,
1
],
"end": [
393,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_eq",
"code": "theorem any_eq {l : List α} : l.any p = decide (∃ x, x ∈ l ∧ p x)",
"start": [
397,
1
],
"end": [
397,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_eq",
"code": "theorem all_eq {l : List α} : l.all p = decide (∀ x, x ∈ l → p x)",
"start": [
399,
1
],
"end": [
399,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_eq_true",
"code": "@[simp] theorem any_eq_true {l : List α} : l.any p ↔ ∃ x, x ∈ l ∧ p x",
"start": [
401,
1
],
"end": [
401,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_eq_true",
"code": "@[simp] theorem all_eq_true {l : List α} : l.all p ↔ ∀ x, x ∈ l → p x",
"start": [
403,
1
],
"end": [
403,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_nil",
"code": "@[simp] theorem set_nil (n : Nat) (a : α) : [].set n a = []",
"start": [
408,
1
],
"end": [
408,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_cons_zero",
"code": "@[simp] theorem set_cons_zero (x : α) (xs : List α) (a : α) :\n (x :: xs).set 0 a = a :: xs",
"start": [
409,
1
],
"end": [
410,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_cons_succ",
"code": "@[simp] theorem set_cons_succ (x : α) (xs : List α) (n : Nat) (a : α) :\n (x :: xs).set (n + 1) a = x :: xs.set n a",
"start": [
411,
1
],
"end": [
412,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_set_eq",
"code": "@[simp] theorem getElem_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :\n (l.set i a)[i] = a",
"start": [
414,
1
],
"end": [
421,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_set_eq",
"code": "@[deprecated getElem_set_eq (since := \"2024-06-12\")]\ntheorem get_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :\n (l.set i a).get ⟨i, h⟩ = a",
"start": [
423,
1
],
"end": [
426,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_set_eq",
"code": "@[simp] theorem getElem?_set_eq {l : List α} {i : Nat} {a : α} (h : i < (l.set i a).length) :\n (l.set i a)[i]? = some a",
"start": [
428,
1
],
"end": [
430,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_set_ne",
"code": "@[simp] theorem getElem_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α}\n (hj : j < (l.set i a).length) :\n (l.set i a)[j] = l[j]'(by simp at hj; exact hj)",
"start": [
432,
1
],
"end": [
442,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_set_ne",
"code": "@[deprecated getElem_set_ne (since := \"2024-06-12\")]\ntheorem get_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α}\n (hj : j < (l.set i a).length) :\n (l.set i a).get ⟨j, hj⟩ = l.get ⟨j, by simp at hj; exact hj⟩",
"start": [
444,
1
],
"end": [
448,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_set_ne",
"code": "@[simp] theorem getElem?_set_ne {l : List α} {i j : Nat} (h : i ≠ j) {a : α} :\n (l.set i a)[j]? = l[j]?",
"start": [
450,
1
],
"end": [
455,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_set",
"code": "theorem getElem_set {l : List α} {m n} {a} (h) :\n (set l m a)[n]'h = if m = n then a else l[n]'(length_set .. ▸ h)",
"start": [
457,
1
],
"end": [
462,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_set",
"code": "@[deprecated getElem_set (since := \"2024-06-12\")]\ntheorem get_set {l : List α} {m n} {a : α} (h) :\n (set l m a).get ⟨n, h⟩ = if m = n then a else l.get ⟨n, length_set .. ▸ h⟩",
"start": [
464,
1
],
"end": [
467,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_set",
"code": "theorem getElem?_set {l : List α} {i j : Nat} {a : α} :\n (l.set i a)[j]? = if i = j then if i < l.length then some a else none else l[j]?",
"start": [
469,
1
],
"end": [
478,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_eq_of_length_le",
"code": "theorem set_eq_of_length_le {l : List α} {n : Nat} (h : l.length ≤ n) {a : α} :\n l.set n a = l",
"start": [
480,
1
],
"end": [
489,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_eq_nil",
"code": "@[simp] theorem set_eq_nil (l : List α) (n : Nat) (a : α) : l.set n a = [] ↔ l = []",
"start": [
491,
1
],
"end": [
492,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_comm",
"code": "theorem set_comm (a b : α) : ∀ {n m : Nat} (l : List α), n ≠ m →\n (l.set n a).set m b = (l.set m b).set n a",
"start": [
494,
1
],
"end": [
500,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_set",
"code": "@[simp]\ntheorem set_set (a b : α) : ∀ (l : List α) (n : Nat), (l.set n a).set n b = l.set n b",
"start": [
502,
1
],
"end": [
506,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_set",
"code": "theorem mem_set (l : List α) (n : Nat) (h : n < l.length) (a : α) :\n a ∈ l.set n a",
"start": [
508,
1
],
"end": [
511,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_or_eq_of_mem_set",
"code": "theorem mem_or_eq_of_mem_set : ∀ {l : List α} {n : Nat} {a b : α}, a ∈ l.set n b → a ∈ l ∨ a = b",
"start": [
513,
1
],
"end": [
516,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lt_irrefl'",
"code": "theorem lt_irrefl' [LT α] (lt_irrefl : ∀ x : α, ¬x < x) (l : List α) : ¬l < l",
"start": [
522,
1
],
"end": [
527,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lt_trans'",
"code": "theorem lt_trans' [LT α] [DecidableRel (@LT.lt α _)]\n (lt_trans : ∀ {x y z : α}, x < y → y < z → x < z)\n (le_trans : ∀ {x y z : α}, ¬x < y → ¬y < z → ¬x < z)\n {l₁ l₂ l₃ : List α} (h₁ : l₁ < l₂) (h₂ : l₂ < l₃) : l₁ < l₃",
"start": [
529,
1
],
"end": [
545,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lt_antisymm'",
"code": "theorem lt_antisymm' [LT α]\n (lt_antisymm : ∀ {x y : α}, ¬x < y → ¬y < x → x = y)\n {l₁ l₂ : List α} (h₁ : ¬l₁ < l₂) (h₂ : ¬l₂ < l₁) : l₁ = l₂",
"start": [
547,
1
],
"end": [
561,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldlM_reverse",
"code": "@[simp] theorem foldlM_reverse [Monad m] (l : List α) (f : β → α → m β) (b) :\n l.reverse.foldlM f b = l.foldrM (fun x y => f y x) b",
"start": [
565,
1
],
"end": [
566,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldlM_append",
"code": "@[simp] theorem foldlM_append [Monad m] [LawfulMonad m] (f : β → α → m β) (b) (l l' : List α) :\n (l ++ l').foldlM f b = l.foldlM f b >>= l'.foldlM f",
"start": [
568,
1
],
"end": [
570,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldrM_cons",
"code": "@[simp] theorem foldrM_cons [Monad m] [LawfulMonad m] (a : α) (l) (f : α → β → m β) (b) :\n (a :: l).foldrM f b = l.foldrM f b >>= f a",
"start": [
572,
1
],
"end": [
575,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_eq_foldlM",
"code": "theorem foldl_eq_foldlM (f : β → α → β) (b) (l : List α) :\n l.foldl f b = l.foldlM (m := Id) f b",
"start": [
577,
1
],
"end": [
579,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_eq_foldrM",
"code": "theorem foldr_eq_foldrM (f : α → β → β) (b) (l : List α) :\n l.foldr f b = l.foldrM (m := Id) f b",
"start": [
581,
1
],
"end": [
583,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldrM_append",
"code": "@[simp] theorem foldrM_append [Monad m] [LawfulMonad m] (f : α → β → m β) (b) (l l' : List α) :\n (l ++ l').foldrM f b = l'.foldrM f b >>= l.foldrM f",
"start": [
587,
1
],
"end": [
589,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_append",
"code": "@[simp] theorem foldl_append {β : Type _} (f : β → α → β) (b) (l l' : List α) :\n (l ++ l').foldl f b = l'.foldl f (l.foldl f b)",
"start": [
591,
1
],
"end": [
592,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_append",
"code": "@[simp] theorem foldr_append (f : α → β → β) (b) (l l' : List α) :\n (l ++ l').foldr f b = l.foldr f (l'.foldr f b)",
"start": [
594,
1
],
"end": [
595,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_self_append",
"code": "@[simp] theorem foldr_self_append (l : List α) : l.foldr cons l' = l ++ l'",
"start": [
597,
1
],
"end": [
598,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_self",
"code": "theorem foldr_self (l : List α) : l.foldr cons [] = l",
"start": [
600,
1
],
"end": [
600,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_map",
"code": "theorem foldl_map (f : β₁ → β₂) (g : α → β₂ → α) (l : List β₁) (init : α) :\n (l.map f).foldl g init = l.foldl (fun x y => g x (f y)) init",
"start": [
602,
1
],
"end": [
604,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_map",
"code": "theorem foldr_map (f : α₁ → α₂) (g : α₂ → β → β) (l : List α₁) (init : β) :\n (l.map f).foldr g init = l.foldr (fun x y => g (f x) y) init",
"start": [
606,
1
],
"end": [
608,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_map'",
"code": "theorem foldl_map' {α β : Type u} (g : α → β) (f : α → α → α) (f' : β → β → β) (a : α) (l : List α)\n (h : ∀ x y, f' (g x) (g y) = g (f x y)) :\n (l.map g).foldl f' (g a) = g (l.foldl f a)",
"start": [
610,
1
],
"end": [
615,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_map'",
"code": "theorem foldr_map' {α β : Type u} (g : α → β) (f : α → α → α) (f' : β → β → β) (a : α) (l : List α)\n (h : ∀ x y, f' (g x) (g y) = g (f x y)) :\n (l.map g).foldr f' (g a) = g (l.foldr f a)",
"start": [
617,
1
],
"end": [
622,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD_eq_getElem?",
"code": "@[simp] theorem getD_eq_getElem? (l) (n) (a : α) : getD l n a = (l[n]?).getD a",
"start": [
626,
1
],
"end": [
627,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getD_eq_get?",
"code": "@[deprecated getD_eq_getElem? (since := \"2024-06-12\")]\ntheorem getD_eq_get? : ∀ l n (a : α), getD l n a = (get? l n).getD a",
"start": [
629,
1
],
"end": [
630,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_eq_get",
"code": "theorem getLast_eq_get : ∀ (l : List α) (h : l ≠ []),\n getLast l h = l.get ⟨l.length - 1, by\n match l with\n | [] => contradiction\n | a :: l => exact Nat.le_refl _⟩",
"start": [
634,
1
],
"end": [
641,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_cons'",
"code": "theorem getLast_cons' {a : α} {l : List α} : ∀ (h₁ : a :: l ≠ nil) (h₂ : l ≠ nil),\n getLast (a :: l) h₁ = getLast l h₂",
"start": [
643,
1
],
"end": [
645,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_eq_getLastD",
"code": "theorem getLast_eq_getLastD (a l h) : @getLast α (a::l) h = getLastD l a",
"start": [
647,
1
],
"end": [
648,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_eq_getLast?",
"code": "theorem getLastD_eq_getLast? (a l) : @getLastD α l a = (getLast? l).getD a",
"start": [
650,
1
],
"end": [
651,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_singleton",
"code": "@[simp] theorem getLast_singleton (a h) : @getLast α [a] h = a",
"start": [
653,
1
],
"end": [
653,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast!_cons",
"code": "theorem getLast!_cons [Inhabited α] : @getLast! α _ (a::l) = getLastD l a",
"start": [
655,
1
],
"end": [
656,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_mem",
"code": "theorem getLast_mem : ∀ {l : List α} (h : l ≠ []), getLast l h ∈ l",
"start": [
658,
1
],
"end": [
661,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_mem_cons",
"code": "theorem getLastD_mem_cons : ∀ (l : List α) (a : α), getLastD l a ∈ a::l",
"start": [
663,
1
],
"end": [
665,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_cons_length",
"code": "theorem getElem_cons_length (x : α) (xs : List α) (n : Nat) (h : n = xs.length) :\n (x :: xs)[n]'(by simp [h]) = (x :: xs).getLast (cons_ne_nil x xs)",
"start": [
667,
1
],
"end": [
669,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_length",
"code": "@[deprecated getElem_cons_length (since := \"2024-06-12\")]\ntheorem get_cons_length (x : α) (xs : List α) (n : Nat) (h : n = xs.length) :\n (x :: xs).get ⟨n, by simp [h]⟩ = (x :: xs).getLast (cons_ne_nil x xs)",
"start": [
671,
1
],
"end": [
674,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_cons",
"code": "theorem getLast?_cons : @getLast? α (a::l) = getLastD l a",
"start": [
678,
1
],
"end": [
679,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_singleton",
"code": "@[simp] theorem getLast?_singleton (a : α) : getLast? [a] = a",
"start": [
681,
1
],
"end": [
681,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_eq_getLast",
"code": "theorem getLast?_eq_getLast : ∀ l h, @getLast? α l = some (getLast l h)",
"start": [
683,
1
],
"end": [
685,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_eq_get?",
"code": "theorem getLast?_eq_get? : ∀ (l : List α), getLast? l = l.get? (l.length - 1)",
"start": [
687,
1
],
"end": [
689,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_concat",
"code": "@[simp] theorem getLast?_concat (l : List α) : getLast? (l ++ [a]) = some a",
"start": [
691,
1
],
"end": [
692,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_concat",
"code": "@[simp] theorem getLastD_concat (a b l) : @getLastD α (l ++ [b]) a = b",
"start": [
694,
1
],
"end": [
695,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head!_of_head?",
"code": "theorem head!_of_head? [Inhabited α] : ∀ {l : List α}, head? l = some a → head! l = a",
"start": [
701,
1
],
"end": [
702,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?_eq_head",
"code": "theorem head?_eq_head : ∀ l h, @head? α l = some (head l h)",
"start": [
704,
1
],
"end": [
705,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tailD_eq_tail?",
"code": "@[simp] theorem tailD_eq_tail? (l l' : List α) : tailD l l' = (tail? l).getD l'",
"start": [
709,
1
],
"end": [
710,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_id",
"code": "@[simp] theorem map_id (l : List α) : map id l = l",
"start": [
716,
1
],
"end": [
716,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_id'",
"code": "@[simp] theorem map_id' (l : List α) : map (fun a => a) l = l",
"start": [
718,
1
],
"end": [
718,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_id''",
"code": "theorem map_id'' {f : α → α} (h : ∀ x, f x = x) (l : List α) : map f l = l",
"start": [
720,
1
],
"end": [
721,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_singleton",
"code": "theorem map_singleton (f : α → β) (a : α) : map f [a] = [f a]",
"start": [
723,
1
],
"end": [
723,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_map",
"code": "@[simp] theorem length_map (as : List α) (f : α → β) : (as.map f).length = as.length",
"start": [
725,
1
],
"end": [
728,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_map",
"code": "@[simp] theorem getElem?_map (f : α → β) : ∀ (l : List α) (n : Nat), (map f l)[n]? = Option.map f l[n]?",
"start": [
730,
1
],
"end": [
733,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_map",
"code": "@[deprecated getElem?_map (since := \"2024-06-12\")]\ntheorem get?_map (f : α → β) : ∀ l n, (map f l).get? n = (l.get? n).map f",
"start": [
735,
1
],
"end": [
739,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_map",
"code": "@[simp] theorem getElem_map (f : α → β) {l} {n : Nat} {h : n < (map f l).length} :\n (map f l)[n] = f (l[n]'(length_map l f ▸ h))",
"start": [
741,
1
],
"end": [
743,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_map",
"code": "@[deprecated getElem_map (since := \"2024-06-12\")]\ntheorem get_map (f : α → β) {l n} :\n get (map f l) n = f (get l ⟨n, length_map l f ▸ n.2⟩)",
"start": [
745,
1
],
"end": [
748,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_map",
"code": "@[simp] theorem mem_map {f : α → β} : ∀ {l : List α}, b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b",
"start": [
750,
1
],
"end": [
752,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_of_mem_map",
"code": "theorem exists_of_mem_map (h : b ∈ map f l) : ∃ a, a ∈ l ∧ f a = b",
"start": [
754,
1
],
"end": [
754,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_map_of_mem",
"code": "theorem mem_map_of_mem (f : α → β) (h : a ∈ l) : f a ∈ map f l",
"start": [
756,
1
],
"end": [
756,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_inj_left",
"code": "@[simp] theorem map_inj_left {f g : α → β} : map f l = map g l ↔ ∀ a ∈ l, f a = g a",
"start": [
758,
1
],
"end": [
759,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_congr_left",
"code": "theorem map_congr_left (h : ∀ a ∈ l, f a = g a) : map f l = map g l",
"start": [
761,
1
],
"end": [
762,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_inj",
"code": "theorem map_inj : map f = map g ↔ f = g",
"start": [
764,
1
],
"end": [
767,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_nil",
"code": "@[simp] theorem map_eq_nil {f : α → β} {l : List α} : map f l = [] ↔ l = []",
"start": [
769,
1
],
"end": [
770,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_nil_of_map_eq_nil",
"code": "theorem eq_nil_of_map_eq_nil {f : α → β} {l : List α} (h : map f l = []) : l = []",
"start": [
772,
1
],
"end": [
773,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_cons",
"code": "theorem map_eq_cons {f : α → β} {l : List α} :\n map f l = b :: l₂ ↔ l.head?.map f = some b ∧ l.tail?.map (map f) = some l₂",
"start": [
775,
1
],
"end": [
777,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_cons'",
"code": "theorem map_eq_cons' {f : α → β} {l : List α} :\n map f l = b :: l₂ ↔ ∃ a l₁, l = a :: l₁ ∧ f a = b ∧ map f l₁ = l₂",
"start": [
779,
1
],
"end": [
789,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_foldr",
"code": "theorem map_eq_foldr (f : α → β) (l : List α) : map f l = foldr (fun a bs => f a :: bs) [] l",
"start": [
791,
1
],
"end": [
792,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.set_map",
"code": "@[simp] theorem set_map {f : α → β} {l : List α} {n : Nat} {a : α} :\n (map f l).set n (f a) = map f (l.set n a)",
"start": [
794,
1
],
"end": [
798,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head_map",
"code": "@[simp] theorem head_map (f : α → β) (l : List α) (w) :\n head (map f l) w = f (head l (by simpa using w))",
"start": [
800,
1
],
"end": [
804,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?_map",
"code": "@[simp] theorem head?_map (f : α → β) (l : List α) : head? (map f l) = (head? l).map f",
"start": [
806,
1
],
"end": [
807,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.headD_map",
"code": "@[simp] theorem headD_map (f : α → β) (l : List α) (a : α) : headD (map f l) (f a) = f (headD l a)",
"start": [
809,
1
],
"end": [
810,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tail?_map",
"code": "@[simp] theorem tail?_map (f : α → β) (l : List α) : tail? (map f l) = (tail? l).map (map f)",
"start": [
812,
1
],
"end": [
813,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.tailD_map",
"code": "@[simp] theorem tailD_map (f : α → β) (l : List α) (l' : List α) :\n tailD (map f l) (map f l') = map f (tailD l l')",
"start": [
815,
1
],
"end": [
817,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_map",
"code": "@[simp] theorem getLast_map (f : α → β) (l : List α) (h) :\n getLast (map f l) h = f (getLast l (by simpa using h))",
"start": [
819,
1
],
"end": [
827,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_map",
"code": "@[simp] theorem getLast?_map (f : α → β) (l : List α) : getLast? (map f l) = (getLast? l).map f",
"start": [
829,
1
],
"end": [
832,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLastD_map",
"code": "@[simp] theorem getLastD_map (f : α → β) (l : List α) (a : α) : getLastD (map f l) (f a) = f (getLastD l a)",
"start": [
834,
1
],
"end": [
837,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_append",
"code": "@[simp] theorem map_append (f : α → β) : ∀ l₁ l₂, map f (l₁ ++ l₂) = map f l₁ ++ map f l₂",
"start": [
839,
1
],
"end": [
840,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_map",
"code": "@[simp] theorem map_map (g : β → γ) (f : α → β) (l : List α) :\n map g (map f l) = map (g ∘ f) l",
"start": [
842,
1
],
"end": [
843,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forall_mem_map_iff",
"code": "theorem forall_mem_map_iff {f : α → β} {l : List α} {P : β → Prop} :\n (∀ (i) (_ : i ∈ l.map f), P i) ↔ ∀ (j) (_ : j ∈ l), P (f j)",
"start": [
845,
1
],
"end": [
847,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_cons_of_pos",
"code": "@[simp] theorem filter_cons_of_pos {p : α → Bool} {a : α} (l) (pa : p a) :\n filter p (a :: l) = a :: filter p l",
"start": [
851,
1
],
"end": [
852,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_cons_of_neg",
"code": "@[simp] theorem filter_cons_of_neg {p : α → Bool} {a : α} (l) (pa : ¬ p a) :\n filter p (a :: l) = filter p l",
"start": [
854,
1
],
"end": [
855,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_cons",
"code": "theorem filter_cons :\n (x :: xs : List α).filter p = if p x then x :: (xs.filter p) else xs.filter p",
"start": [
857,
1
],
"end": [
859,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_filter_le",
"code": "theorem length_filter_le (p : α → Bool) (l : List α) :\n (l.filter p).length ≤ l.length",
"start": [
861,
1
],
"end": [
870,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_eq_self",
"code": "@[simp]\ntheorem filter_eq_self {l} : filter p l = l ↔ ∀ a ∈ l, p a",
"start": [
872,
1
],
"end": [
877,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_length_eq_length",
"code": "@[simp]\ntheorem filter_length_eq_length {l} : (filter p l).length = l.length ↔ ∀ a ∈ l, p a",
"start": [
879,
1
],
"end": [
888,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_filter",
"code": "theorem mem_filter : x ∈ filter p as ↔ x ∈ as ∧ p x",
"start": [
890,
1
],
"end": [
896,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_eq_nil",
"code": "theorem filter_eq_nil {l} : filter p l = [] ↔ ∀ a, a ∈ l → ¬p a",
"start": [
898,
1
],
"end": [
899,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_filter",
"code": "@[simp] theorem filter_filter (q) : ∀ l, filter p (filter q l) = filter (fun a => p a ∧ q a) l",
"start": [
901,
1
],
"end": [
903,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_map",
"code": "theorem filter_map (f : β → α) (l : List β) : filter p (map f l) = map f (filter (p ∘ f) l)",
"start": [
905,
1
],
"end": [
908,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_filter",
"code": "@[deprecated filter_map (since := \"2024-06-15\")] abbrev map_filter := @filter_map",
"start": [
910,
1
],
"end": [
910,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_filter_eq_foldr",
"code": "theorem map_filter_eq_foldr (f : α → β) (p : α → Bool) (as : List α) :\n map f (filter p as) = foldr (fun a bs => bif p a then f a :: bs else bs) [] as",
"start": [
912,
1
],
"end": [
918,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_append",
"code": "@[simp] theorem filter_append {p : α → Bool} :\n ∀ (l₁ l₂ : List α), filter p (l₁ ++ l₂) = filter p l₁ ++ filter p l₂",
"start": [
920,
1
],
"end": [
923,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_congr",
"code": "theorem filter_congr {p q : α → Bool} :\n ∀ {l : List α}, (∀ x ∈ l, p x = q x) → filter p l = filter q l",
"start": [
925,
1
],
"end": [
931,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_congr'",
"code": "@[deprecated filter_congr (since := \"2024-06-20\")] abbrev filter_congr' := @filter_congr",
"start": [
933,
1
],
"end": [
933,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_cons_none",
"code": "@[simp] theorem filterMap_cons_none {f : α → Option β} (a : α) (l : List α) (h : f a = none) :\n filterMap f (a :: l) = filterMap f l",
"start": [
937,
1
],
"end": [
938,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_cons_some",
"code": "@[simp] theorem filterMap_cons_some (f : α → Option β) (a : α) (l : List α) {b : β} (h : f a = some b) :\n filterMap f (a :: l) = b :: filterMap f l",
"start": [
940,
1
],
"end": [
941,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_eq_map",
"code": "@[simp]\ntheorem filterMap_eq_map (f : α → β) : filterMap (some ∘ f) = map f",
"start": [
943,
1
],
"end": [
945,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_some",
"code": "@[simp] theorem filterMap_some (l : List α) : filterMap some l = l",
"start": [
947,
1
],
"end": [
948,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_filterMap_some_eq_filter_map_is_some",
"code": "theorem map_filterMap_some_eq_filter_map_is_some (f : α → Option β) (l : List α) :\n (l.filterMap f).map some = (l.map f).filter fun b => b.isSome",
"start": [
950,
1
],
"end": [
952,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_filterMap_le",
"code": "theorem length_filterMap_le (f : α → Option β) (l : List α) :\n (filterMap f l).length ≤ l.length",
"start": [
954,
1
],
"end": [
957,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_length_eq_length",
"code": "@[simp]\ntheorem filterMap_length_eq_length {l} :\n (filterMap f l).length = l.length ↔ ∀ a ∈ l, (f a).isSome",
"start": [
959,
1
],
"end": [
969,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_eq_filter",
"code": "@[simp]\ntheorem filterMap_eq_filter (p : α → Bool) :\n filterMap (Option.guard (p ·)) = filter p",
"start": [
971,
1
],
"end": [
977,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_filterMap",
"code": "theorem filterMap_filterMap (f : α → Option β) (g : β → Option γ) (l : List α) :\n filterMap g (filterMap f l) = filterMap (fun x => (f x).bind g) l",
"start": [
979,
1
],
"end": [
983,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_filterMap",
"code": "theorem map_filterMap (f : α → Option β) (g : β → γ) (l : List α) :\n map g (filterMap f l) = filterMap (fun x => (f x).map g) l",
"start": [
985,
1
],
"end": [
987,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_map",
"code": "@[simp]\ntheorem filterMap_map (f : α → β) (g : β → Option γ) (l : List α) :\n filterMap g (map f l) = filterMap (g ∘ f) l",
"start": [
989,
1
],
"end": [
992,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_filterMap",
"code": "theorem filter_filterMap (f : α → Option β) (p : β → Bool) (l : List α) :\n filter p (filterMap f l) = filterMap (fun x => (f x).filter p) l",
"start": [
994,
1
],
"end": [
997,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_filter",
"code": "theorem filterMap_filter (p : α → Bool) (f : α → Option β) (l : List α) :\n filterMap f (filter p l) = filterMap (fun x => if p x then f x else none) l",
"start": [
999,
1
],
"end": [
1002,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_filterMap",
"code": "@[simp] theorem mem_filterMap (f : α → Option β) (l : List α) {b : β} :\n b ∈ filterMap f l ↔ ∃ a, a ∈ l ∧ f a = some b",
"start": [
1004,
1
],
"end": [
1006,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_append",
"code": "theorem filterMap_append {α β : Type _} (l l' : List α) (f : α → Option β) :\n filterMap f (l ++ l') = filterMap f l ++ filterMap f l'",
"start": [
1008,
1
],
"end": [
1010,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_join",
"code": "@[simp] theorem filterMap_join (f : α → Option β) (L : List (List α)) :\n filterMap f (join L) = join (map (filterMap f) L)",
"start": [
1012,
1
],
"end": [
1014,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_filterMap_of_inv",
"code": "theorem map_filterMap_of_inv (f : α → Option β) (g : β → α) (H : ∀ x : α, (f x).map g = some x)\n (l : List α) : map g (filterMap f l) = l",
"start": [
1016,
1
],
"end": [
1017,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_append_right",
"code": "theorem getElem?_append_right : ∀ {l₁ l₂ : List α} {n : Nat}, l₁.length ≤ n →\n (l₁ ++ l₂)[n]? = l₂[n - l₁.length]?",
"start": [
1021,
1
],
"end": [
1026,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_append_right",
"code": "@[deprecated getElem?_append_right (since := \"2024-06-12\")]\ntheorem get?_append_right {l₁ l₂ : List α} {n : Nat} (h : l₁.length ≤ n) :\n (l₁ ++ l₂).get? n = l₂.get? (n - l₁.length)",
"start": [
1028,
1
],
"end": [
1031,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_append_right'",
"code": "theorem getElem_append_right' {l₁ l₂ : List α} {n : Nat} (h₁ : l₁.length ≤ n) (h₂) :\n (l₁ ++ l₂)[n]'h₂ =\n l₂[n - l₁.length]'(by rw [length_append] at h₂; exact Nat.sub_lt_left_of_lt_add h₁ h₂)",
"start": [
1033,
1
],
"end": [
1036,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_append_right_aux",
"code": "@[deprecated (since := \"2024-06-12\")]\ntheorem get_append_right_aux {l₁ l₂ : List α} {n : Nat}\n (h₁ : l₁.length ≤ n) (h₂ : n < (l₁ ++ l₂).length) : n - l₁.length < l₂.length",
"start": [
1038,
1
],
"end": [
1042,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_append_right'",
"code": "@[deprecated getElem_append_right' (since := \"2024-06-12\")]\ntheorem get_append_right' {l₁ l₂ : List α} {n : Nat} (h₁ : l₁.length ≤ n) (h₂) :\n (l₁ ++ l₂).get ⟨n, h₂⟩ = l₂.get ⟨n - l₁.length, get_append_right_aux h₁ h₂⟩",
"start": [
1045,
1
],
"end": [
1048,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_of_append",
"code": "theorem getElem_of_append {l : List α} (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) :\n l[n]'(eq ▸ h ▸ by simp_arith) = a",
"start": [
1050,
1
],
"end": [
1053,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_of_append_proof",
"code": "@[deprecated (since := \"2024-06-12\")]\ntheorem get_of_append_proof {l : List α}\n (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) : n < length l",
"start": [
1055,
1
],
"end": [
1057,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_of_append",
"code": "@[deprecated getElem_of_append (since := \"2024-06-12\")]\ntheorem get_of_append {l : List α} (eq : l = l₁ ++ a :: l₂) (h : l₁.length = n) :\n l.get ⟨n, get_of_append_proof eq h⟩ = a",
"start": [
1060,
1
],
"end": [
1063,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_of_mem",
"code": "theorem append_of_mem {a : α} {l : List α} : a ∈ l → ∃ s t : List α, l = s ++ a :: t",
"start": [
1065,
1
],
"end": [
1067,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "List.singleton_append",
"code": "@[simp 1100] theorem singleton_append : [x] ++ l = x :: l",
"start": [
1069,
1
],
"end": [
1069,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj",
"code": "theorem append_inj :\n ∀ {s₁ s₂ t₁ t₂ : List α}, s₁ ++ t₁ = s₂ ++ t₂ → length s₁ = length s₂ → s₁ = s₂ ∧ t₁ = t₂",
"start": [
1071,
1
],
"end": [
1075,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj_right",
"code": "theorem append_inj_right (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length s₁ = length s₂) : t₁ = t₂",
"start": [
1077,
1
],
"end": [
1078,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj_left",
"code": "theorem append_inj_left (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length s₁ = length s₂) : s₁ = s₂",
"start": [
1080,
1
],
"end": [
1081,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj'",
"code": "theorem append_inj' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : s₁ = s₂ ∧ t₁ = t₂",
"start": [
1083,
1
],
"end": [
1085,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj_right'",
"code": "theorem append_inj_right' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : t₁ = t₂",
"start": [
1087,
1
],
"end": [
1088,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_inj_left'",
"code": "theorem append_inj_left' (h : s₁ ++ t₁ = s₂ ++ t₂) (hl : length t₁ = length t₂) : s₁ = s₂",
"start": [
1090,
1
],
"end": [
1091,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_right_inj",
"code": "theorem append_right_inj {t₁ t₂ : List α} (s) : s ++ t₁ = s ++ t₂ ↔ t₁ = t₂",
"start": [
1093,
1
],
"end": [
1094,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_left_inj",
"code": "theorem append_left_inj {s₁ s₂ : List α} (t) : s₁ ++ t = s₂ ++ t ↔ s₁ = s₂",
"start": [
1096,
1
],
"end": [
1097,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq_nil",
"code": "@[simp] theorem append_eq_nil : p ++ q = [] ↔ p = [] ∧ q = []",
"start": [
1099,
1
],
"end": [
1100,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_append",
"code": "@[simp] theorem getLast_append {a : α} : ∀ (l : List α) h, getLast (l ++ [a]) h = a",
"start": [
1102,
1
],
"end": [
1105,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast_concat",
"code": "theorem getLast_concat : getLast (concat l a) h = a",
"start": [
1107,
1
],
"end": [
1108,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_append",
"code": "theorem getElem_append : ∀ {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length),\n (l₁ ++ l₂)[n]'(length_append .. ▸ Nat.lt_add_right _ h) = l₁[n]",
"start": [
1110,
1
],
"end": [
1113,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_append",
"code": "@[deprecated getElem_append (since := \"2024-06-12\")]\ntheorem get_append {l₁ l₂ : List α} (n : Nat) (h : n < l₁.length) :\n (l₁ ++ l₂).get ⟨n, length_append .. ▸ Nat.lt_add_right _ h⟩ = l₁.get ⟨n, h⟩",
"start": [
1115,
1
],
"end": [
1118,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_append_left",
"code": "@[deprecated getElem_append_left (since := \"2024-06-12\")]\ntheorem get_append_left (as bs : List α) (h : i < as.length) {h'} : (as ++ bs).get ⟨i, h'⟩ = as.get ⟨i, h⟩",
"start": [
1120,
1
],
"end": [
1122,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_append_right",
"code": "@[deprecated getElem_append_right (since := \"2024-06-12\")]\ntheorem get_append_right (as bs : List α) (h : ¬ i < as.length) {h' h''} : (as ++ bs).get ⟨i, h'⟩ = bs.get ⟨i - as.length, h''⟩",
"start": [
1124,
1
],
"end": [
1126,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_append",
"code": "theorem getElem?_append {l₁ l₂ : List α} {n : Nat} (hn : n < l₁.length) :\n (l₁ ++ l₂)[n]? = l₁[n]?",
"start": [
1128,
1
],
"end": [
1132,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_append",
"code": "@[deprecated (since := \"2024-06-12\")]\ntheorem get?_append {l₁ l₂ : List α} {n : Nat} (hn : n < l₁.length) :\n (l₁ ++ l₂).get? n = l₁.get? n",
"start": [
1134,
1
],
"end": [
1137,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq_append",
"code": "theorem append_eq_append : List.append l₁ l₂ = l₁ ++ l₂",
"start": [
1139,
1
],
"end": [
1139,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_ne_nil_of_ne_nil_left",
"code": "theorem append_ne_nil_of_ne_nil_left (s t : List α) : s ≠ [] → s ++ t ≠ []",
"start": [
1141,
1
],
"end": [
1141,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_ne_nil_of_ne_nil_right",
"code": "theorem append_ne_nil_of_ne_nil_right (s t : List α) : t ≠ [] → s ++ t ≠ []",
"start": [
1143,
1
],
"end": [
1143,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.nil_eq_append",
"code": "@[simp] theorem nil_eq_append : [] = a ++ b ↔ a = [] ∧ b = []",
"start": [
1145,
1
],
"end": [
1146,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_ne_nil_of_left_ne_nil",
"code": "theorem append_ne_nil_of_left_ne_nil (a b : List α) (h0 : a ≠ []) : a ++ b ≠ []",
"start": [
1148,
1
],
"end": [
1148,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq_cons",
"code": "theorem append_eq_cons :\n a ++ b = x :: c ↔ (a = [] ∧ b = x :: c) ∨ (∃ a', a = x :: a' ∧ c = a' ++ b)",
"start": [
1150,
1
],
"end": [
1153,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.cons_eq_append",
"code": "theorem cons_eq_append :\n x :: c = a ++ b ↔ (a = [] ∧ b = x :: c) ∨ (∃ a', a = x :: a' ∧ c = a' ++ b)",
"start": [
1155,
1
],
"end": [
1157,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_eq_append_iff",
"code": "theorem append_eq_append_iff {a b c d : List α} :\n a ++ b = c ++ d ↔ (∃ a', c = a ++ a' ∧ b = a' ++ d) ∨ ∃ c', a = c ++ c' ∧ d = c' ++ b",
"start": [
1159,
1
],
"end": [
1163,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append",
"code": "@[simp] theorem mem_append {a : α} {s t : List α} : a ∈ s ++ t ↔ a ∈ s ∨ a ∈ t",
"start": [
1165,
1
],
"end": [
1166,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_mem_append",
"code": "theorem not_mem_append {a : α} {s t : List α} (h₁ : a ∉ s) (h₂ : a ∉ t) : a ∉ s ++ t",
"start": [
1168,
1
],
"end": [
1169,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append_eq",
"code": "theorem mem_append_eq (a : α) (s t : List α) : (a ∈ s ++ t) = (a ∈ s ∨ a ∈ t)",
"start": [
1171,
1
],
"end": [
1172,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append_left",
"code": "theorem mem_append_left {a : α} {l₁ : List α} (l₂ : List α) (h : a ∈ l₁) : a ∈ l₁ ++ l₂",
"start": [
1174,
1
],
"end": [
1175,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_append_right",
"code": "theorem mem_append_right {a : α} (l₁ : List α) {l₂ : List α} (h : a ∈ l₂) : a ∈ l₁ ++ l₂",
"start": [
1177,
1
],
"end": [
1178,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_iff_append",
"code": "theorem mem_iff_append {a : α} {l : List α} : a ∈ l ↔ ∃ s t : List α, l = s ++ a :: t",
"start": [
1180,
1
],
"end": [
1181,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forall_mem_append",
"code": "theorem forall_mem_append {p : α → Prop} {l₁ l₂ : List α} :\n (∀ (x) (_ : x ∈ l₁ ++ l₂), p x) ↔ (∀ (x) (_ : x ∈ l₁), p x) ∧ (∀ (x) (_ : x ∈ l₂), p x)",
"start": [
1183,
1
],
"end": [
1185,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_nil",
"code": "theorem concat_nil (a : α) : concat [] a = [a]",
"start": [
1194,
1
],
"end": [
1195,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_cons",
"code": "theorem concat_cons (a b : α) (l : List α) : concat (a :: l) b = a :: concat l b",
"start": [
1196,
1
],
"end": [
1197,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.init_eq_of_concat_eq",
"code": "theorem init_eq_of_concat_eq {a b : α} {l₁ l₂ : List α} : concat l₁ a = concat l₂ b → l₁ = l₂",
"start": [
1199,
1
],
"end": [
1202,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.last_eq_of_concat_eq",
"code": "theorem last_eq_of_concat_eq {a b : α} {l₁ l₂ : List α} : concat l₁ a = concat l₂ b → a = b",
"start": [
1204,
1
],
"end": [
1207,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_inj_left",
"code": "theorem concat_inj_left {l l' : List α} (a : α) : concat l a = concat l' a ↔ l = l'",
"start": [
1209,
1
],
"end": [
1210,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_eq_concat",
"code": "theorem concat_eq_concat {l l' : List α} {a b : α} : concat l a = concat l' b ↔ l = l' ∧ a = b",
"start": [
1212,
1
],
"end": [
1213,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_ne_nil",
"code": "theorem concat_ne_nil (a : α) (l : List α) : concat l a ≠ []",
"start": [
1215,
1
],
"end": [
1215,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "List.concat_append",
"code": "theorem concat_append (a : α) (l₁ l₂ : List α) : concat l₁ a ++ l₂ = l₁ ++ a :: l₂",
"start": [
1217,
1
],
"end": [
1217,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_concat",
"code": "theorem append_concat (a : α) (l₁ l₂ : List α) : l₁ ++ concat l₂ a = concat (l₁ ++ l₂) a",
"start": [
1219,
1
],
"end": [
1219,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_concat",
"code": "theorem map_concat (f : α → β) (a : α) (l : List α) : map f (concat l a) = concat (map f l) (f a)",
"start": [
1221,
1
],
"end": [
1224,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_nil_or_concat",
"code": "theorem eq_nil_or_concat : ∀ l : List α, l = [] ∨ ∃ L b, l = concat L b",
"start": [
1226,
1
],
"end": [
1230,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_join",
"code": "@[simp] theorem mem_join : ∀ {L : List (List α)}, a ∈ L.join ↔ ∃ l, l ∈ L ∧ a ∈ l",
"start": [
1234,
1
],
"end": [
1236,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_of_mem_join",
"code": "theorem exists_of_mem_join : a ∈ join L → ∃ l, l ∈ L ∧ a ∈ l",
"start": [
1238,
1
],
"end": [
1238,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_join_of_mem",
"code": "theorem mem_join_of_mem (lL : l ∈ L) (al : a ∈ l) : a ∈ join L",
"start": [
1240,
1
],
"end": [
1240,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_join",
"code": "@[simp] theorem map_join (f : α → β) (L : List (List α)) : map f (join L) = join (map (map f) L)",
"start": [
1242,
1
],
"end": [
1243,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_bind",
"code": "@[simp] theorem append_bind xs ys (f : α → List β) :\n List.bind (xs ++ ys) f = List.bind xs f ++ List.bind ys f",
"start": [
1247,
1
],
"end": [
1249,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_id",
"code": "@[simp] theorem bind_id (l : List (List α)) : List.bind l id = l.join",
"start": [
1251,
1
],
"end": [
1251,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_bind",
"code": "@[simp] theorem mem_bind {f : α → List β} {b} {l : List α} : b ∈ l.bind f ↔ ∃ a, a ∈ l ∧ b ∈ f a",
"start": [
1253,
1
],
"end": [
1255,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_of_mem_bind",
"code": "theorem exists_of_mem_bind {b : β} {l : List α} {f : α → List β} :\n b ∈ List.bind l f → ∃ a, a ∈ l ∧ b ∈ f a",
"start": [
1257,
1
],
"end": [
1258,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_bind_of_mem",
"code": "theorem mem_bind_of_mem {b : β} {l : List α} {f : α → List β} {a} (al : a ∈ l) (h : b ∈ f a) :\n b ∈ List.bind l f",
"start": [
1260,
1
],
"end": [
1261,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_singleton",
"code": "theorem bind_singleton (f : α → List β) (x : α) : [x].bind f = f x",
"start": [
1263,
1
],
"end": [
1264,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_singleton'",
"code": "@[simp] theorem bind_singleton' (l : List α) : (l.bind fun x => [x]) = l",
"start": [
1266,
1
],
"end": [
1267,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_assoc",
"code": "theorem bind_assoc {α β} (l : List α) (f : α → List β) (g : β → List γ) :\n (l.bind f).bind g = l.bind fun x => (f x).bind g",
"start": [
1269,
1
],
"end": [
1271,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_bind",
"code": "theorem map_bind (f : β → γ) (g : α → List β) :\n ∀ l : List α, (l.bind g).map f = l.bind fun a => (g a).map f",
"start": [
1273,
1
],
"end": [
1276,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_map",
"code": "theorem bind_map (f : α → β) (g : β → List γ) (l : List α) : (map f l).bind g = l.bind (fun a => g (f a))",
"start": [
1278,
1
],
"end": [
1279,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_bind",
"code": "theorem map_eq_bind {α β} (f : α → β) (l : List α) : map f l = l.bind fun x => [f x]",
"start": [
1281,
1
],
"end": [
1283,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate_one",
"code": "@[simp] theorem replicate_one : replicate 1 a = [a]",
"start": [
1287,
1
],
"end": [
1287,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.contains_replicate",
"code": "@[simp] theorem contains_replicate [BEq α] {n : Nat} {a b : α} :\n (replicate n b).contains a = (a == b && !n == 0)",
"start": [
1289,
1
],
"end": [
1295,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.decide_mem_replicate",
"code": "@[simp] theorem decide_mem_replicate [BEq α] [LawfulBEq α] {a b : α} :\n ∀ {n}, decide (b ∈ replicate n a) = ((¬ n == 0) && b == a)",
"start": [
1297,
1
],
"end": [
1300,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_replicate",
"code": "@[simp] theorem mem_replicate {a b : α} : ∀ {n}, b ∈ replicate n a ↔ n ≠ 0 ∧ b = a",
"start": [
1302,
1
],
"end": [
1304,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_of_mem_replicate",
"code": "theorem eq_of_mem_replicate {a b : α} {n} (h : b ∈ replicate n a) : b = a",
"start": [
1306,
1
],
"end": [
1306,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate_succ_ne_nil",
"code": "@[simp] theorem replicate_succ_ne_nil (n : Nat) (a : α) : replicate (n+1) a ≠ []",
"start": [
1308,
1
],
"end": [
1309,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_replicate",
"code": "@[simp] theorem getElem_replicate (a : α) {n : Nat} {m} (h : m < (replicate n a).length) :\n (replicate n a)[m] = a",
"start": [
1311,
1
],
"end": [
1313,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_replicate",
"code": "@[deprecated getElem_replicate (since := \"2024-06-12\")]\ntheorem get_replicate (a : α) {n : Nat} (m : Fin _) : (replicate n a).get m = a",
"start": [
1315,
1
],
"end": [
1317,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_replicate",
"code": "theorem getElem?_replicate : (replicate n a)[m]? = if m < n then some a else none",
"start": [
1319,
1
],
"end": [
1322,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_replicate_of_lt",
"code": "@[simp] theorem getElem?_replicate_of_lt {n : Nat} {m : Nat} (h : m < n) : (replicate n a)[m]? = some a",
"start": [
1324,
1
],
"end": [
1325,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replicate_inj",
"code": "@[simp] theorem replicate_inj : replicate n a = replicate m b ↔ n = m ∧ (n = 0 ∨ a = b)",
"start": [
1327,
1
],
"end": [
1338,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_replicate_of_mem",
"code": "theorem eq_replicate_of_mem {a : α} :\n ∀ {l : List α}, (∀ (b) (_ : b ∈ l), b = a) → l = replicate l.length a",
"start": [
1340,
1
],
"end": [
1345,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_replicate",
"code": "theorem eq_replicate {a : α} {n} {l : List α} :\n l = replicate n a ↔ length l = n ∧ ∀ (b) (_ : b ∈ l), b = a",
"start": [
1347,
1
],
"end": [
1350,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_eq_replicate_iff",
"code": "theorem map_eq_replicate_iff {l : List α} {f : α → β} {b : β} :\n l.map f = replicate l.length b ↔ ∀ x ∈ l, f x = b",
"start": [
1352,
1
],
"end": [
1354,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_const",
"code": "@[simp] theorem map_const (l : List α) (b : β) : map (Function.const α b) l = replicate l.length b",
"start": [
1356,
1
],
"end": [
1357,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_const'",
"code": "theorem map_const' (l : List α) (b : β) : map (fun _ => b) l = replicate l.length b",
"start": [
1360,
1
],
"end": [
1361,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.append_replicate_replicate",
"code": "@[simp] theorem append_replicate_replicate : replicate n a ++ replicate m a = replicate (n + m) a",
"start": [
1363,
1
],
"end": [
1369,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_replicate",
"code": "@[simp] theorem map_replicate : (replicate n a).map f = replicate n (f a)",
"start": [
1371,
1
],
"end": [
1374,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_replicate",
"code": "theorem filter_replicate : (replicate n a).filter p = if p a then replicate n a else []",
"start": [
1376,
1
],
"end": [
1381,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_replicate_of_pos",
"code": "@[simp] theorem filter_replicate_of_pos (h : p a) : (replicate n a).filter p = replicate n a",
"start": [
1383,
1
],
"end": [
1384,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filter_replicate_of_neg",
"code": "@[simp] theorem filter_replicate_of_neg (h : ¬ p a) : (replicate n a).filter p = []",
"start": [
1386,
1
],
"end": [
1387,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_replicate",
"code": "theorem filterMap_replicate {f : α → Option β} :\n (replicate n a).filterMap f = match f a with | none => [] | .some b => replicate n b",
"start": [
1389,
1
],
"end": [
1395,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_replicate_of_some",
"code": "theorem filterMap_replicate_of_some {f : α → Option β} (h : f a = some b) :\n (replicate n a).filterMap f = replicate n b",
"start": [
1398,
1
],
"end": [
1400,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_replicate_of_isSome",
"code": "@[simp] theorem filterMap_replicate_of_isSome {f : α → Option β} (h : (f a).isSome) :\n (replicate n a).filterMap f = replicate n (Option.get _ h)",
"start": [
1402,
1
],
"end": [
1406,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.filterMap_replicate_of_none",
"code": "@[simp] theorem filterMap_replicate_of_none {f : α → Option β} (h : f a = none) :\n (replicate n a).filterMap f = []",
"start": [
1408,
1
],
"end": [
1410,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join_replicate_nil",
"code": "@[simp] theorem join_replicate_nil : (replicate n ([] : List α)).join = []",
"start": [
1412,
1
],
"end": [
1413,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join_replicate_singleton",
"code": "@[simp] theorem join_replicate_singleton : (replicate n [a]).join = replicate n a",
"start": [
1415,
1
],
"end": [
1416,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.join_replicate_replicate",
"code": "@[simp] theorem join_replicate_replicate : (replicate n (replicate m a)).join = replicate (n * m) a",
"start": [
1418,
1
],
"end": [
1423,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.bind_replicate",
"code": "theorem bind_replicate {β} (f : α → List β) : (replicate n a).bind f = (replicate n (f a)).join",
"start": [
1425,
1
],
"end": [
1428,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isEmpty_replicate",
"code": "@[simp] theorem isEmpty_replicate : (replicate n a).isEmpty = decide (n = 0)",
"start": [
1430,
1
],
"end": [
1431,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_reverse",
"code": "@[simp] theorem length_reverse (as : List α) : (as.reverse).length = as.length",
"start": [
1435,
1
],
"end": [
1438,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_reverse'",
"code": "theorem getElem?_reverse' : ∀ {l : List α} (i j), i + j + 1 = length l →\n l.reverse[i]? = l[j]?",
"start": [
1440,
1
],
"end": [
1447,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_reverse'",
"code": "@[deprecated getElem?_reverse' (since := \"2024-06-12\")]\ntheorem get?_reverse' {l : List α} (i j) (h : i + j + 1 = length l) : get? l.reverse i = get? l j",
"start": [
1449,
1
],
"end": [
1451,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_reverse",
"code": "theorem getElem?_reverse {l : List α} {i} (h : i < length l) :\n l.reverse[i]? = l[l.length - 1 - i]?",
"start": [
1453,
1
],
"end": [
1457,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_reverse",
"code": "@[deprecated getElem?_reverse (since := \"2024-06-12\")]\ntheorem get?_reverse {l : List α} {i} (h : i < length l) :\n get? l.reverse i = get? l (l.length - 1 - i)",
"start": [
1459,
1
],
"end": [
1462,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_reverseAux_nil",
"code": "theorem reverseAux_reverseAux_nil (as bs : List α) : reverseAux (reverseAux as bs) [] = reverseAux bs as",
"start": [
1464,
1
],
"end": [
1467,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_reverse",
"code": "@[simp] theorem reverse_reverse (as : List α) : as.reverse.reverse = as",
"start": [
1469,
1
],
"end": [
1470,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getLast?_reverse",
"code": "@[simp] theorem getLast?_reverse (l : List α) : l.reverse.getLast? = l.head?",
"start": [
1472,
1
],
"end": [
1472,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "List.head?_reverse",
"code": "@[simp] theorem head?_reverse (l : List α) : l.reverse.head? = l.getLast?",
"start": [
1474,
1
],
"end": [
1475,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_append",
"code": "@[simp] theorem reverse_append (as bs : List α) : (as ++ bs).reverse = bs.reverse ++ as.reverse",
"start": [
1477,
1
],
"end": [
1478,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_reverse",
"code": "@[simp] theorem map_reverse (f : α → β) (l : List α) : l.reverse.map f = (l.map f).reverse",
"start": [
1480,
1
],
"end": [
1481,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_map",
"code": "@[deprecated map_reverse (since := \"2024-06-20\")]\ntheorem reverse_map (f : α → β) (l : List α) : (l.map f).reverse = l.reverse.map f",
"start": [
1483,
1
],
"end": [
1485,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_eq_nil_iff",
"code": "@[simp] theorem reverse_eq_nil_iff {xs : List α} : xs.reverse = [] ↔ xs = []",
"start": [
1487,
1
],
"end": [
1490,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_reverseAux",
"code": "@[simp] theorem mem_reverseAux {x : α} : ∀ {as bs}, x ∈ reverseAux as bs ↔ x ∈ as ∨ x ∈ bs",
"start": [
1492,
1
],
"end": [
1494,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_reverse",
"code": "@[simp] theorem mem_reverse {x : α} {as : List α} : x ∈ reverse as ↔ x ∈ as",
"start": [
1496,
1
],
"end": [
1496,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverseAux_eq",
"code": "theorem reverseAux_eq (as bs : List α) : reverseAux as bs = reverse as ++ bs",
"start": [
1498,
1
],
"end": [
1499,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldrM_reverse",
"code": "@[simp] theorem foldrM_reverse [Monad m] (l : List α) (f : α → β → m β) (b) :\n l.reverse.foldrM f b = l.foldlM (fun x y => f y x) b",
"start": [
1501,
1
],
"end": [
1503,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldl_reverse",
"code": "@[simp] theorem foldl_reverse (l : List α) (f : β → α → β) (b) :\n l.reverse.foldl f b = l.foldr (fun x y => f y x) b",
"start": [
1505,
1
],
"end": [
1506,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "List.foldr_reverse",
"code": "@[simp] theorem foldr_reverse (l : List α) (f : α → β → β) (b) :\n l.reverse.foldr f b = l.foldl (fun x y => f y x) b",
"start": [
1508,
1
],
"end": [
1510,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_replicate",
"code": "@[simp] theorem reverse_replicate (n) (a : α) : reverse (replicate n a) = replicate n a",
"start": [
1512,
1
],
"end": [
1515,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.elem_cons_self",
"code": "@[simp] theorem elem_cons_self [BEq α] [LawfulBEq α] {a : α} : (a::as).elem a = true",
"start": [
1521,
1
],
"end": [
1522,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.contains_cons",
"code": "@[simp] theorem contains_cons [BEq α] :\n (a :: as : List α).contains x = (x == a || as.contains x)",
"start": [
1524,
1
],
"end": [
1527,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.contains_eq_any_beq",
"code": "theorem contains_eq_any_beq [BEq α] (l : List α) (a : α) : l.contains a = l.any (a == ·)",
"start": [
1529,
1
],
"end": [
1530,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_append_drop",
"code": "@[simp] theorem take_append_drop : ∀ (n : Nat) (l : List α), take n l ++ drop n l = l",
"start": [
1540,
1
],
"end": [
1543,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_drop",
"code": "@[simp] theorem length_drop : ∀ (i : Nat) (l : List α), length (drop i l) = length l - i",
"start": [
1545,
1
],
"end": [
1550,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_length_le",
"code": "theorem drop_length_le {l : List α} (h : l.length ≤ i) : drop i l = []",
"start": [
1552,
1
],
"end": [
1553,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_length_le",
"code": "theorem take_length_le {l : List α} (h : l.length ≤ i) : take i l = l",
"start": [
1555,
1
],
"end": [
1557,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_length",
"code": "@[simp] theorem drop_length (l : List α) : drop l.length l = []",
"start": [
1559,
1
],
"end": [
1559,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_length",
"code": "@[simp] theorem take_length (l : List α) : take l.length l = l",
"start": [
1561,
1
],
"end": [
1561,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_concat_get",
"code": "theorem take_concat_get (l : List α) (i : Nat) (h : i < l.length) :\n (l.take i).concat l[i] = l.take (i+1)",
"start": [
1563,
1
],
"end": [
1566,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "List.reverse_concat",
"code": "theorem reverse_concat (l : List α) (a : α) : (l.concat a).reverse = a :: l.reverse",
"start": [
1568,
1
],
"end": [
1569,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_succ_cons",
"code": "abbrev take_succ_cons := @take_cons_succ",
"start": [
1571,
1
],
"end": [
1571,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_all_of_le",
"code": "theorem take_all_of_le {n} {l : List α} (h : length l ≤ n) : take n l = l",
"start": [
1573,
1
],
"end": [
1574,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_left",
"code": "@[simp]\ntheorem take_left : ∀ l₁ l₂ : List α, take (length l₁) (l₁ ++ l₂) = l₁",
"start": [
1576,
1
],
"end": [
1579,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_left'",
"code": "theorem take_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : take n (l₁ ++ l₂) = l₁",
"start": [
1581,
1
],
"end": [
1582,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_take",
"code": "@[simp] theorem map_take (f : α → β) :\n ∀ (L : List α) (i : Nat), (L.take i).map f = (L.map f).take i",
"start": [
1584,
1
],
"end": [
1588,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_take",
"code": "theorem getElem?_take {l : List α} {n m : Nat} (h : m < n) : (l.take n)[m]? = l[m]?",
"start": [
1590,
1
],
"end": [
1600,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_take",
"code": "@[deprecated getElem?_take (since := \"2024-06-12\")]\ntheorem get?_take {l : List α} {n m : Nat} (h : m < n) : (l.take n).get? m = l.get? m",
"start": [
1602,
1
],
"end": [
1604,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_take_of_succ",
"code": "@[simp]\ntheorem get?_take_of_succ {l : List α} {n : Nat} : (l.take (n + 1))[n]? = l[n]?",
"start": [
1606,
1
],
"end": [
1608,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_succ",
"code": "theorem take_succ {l : List α} {n : Nat} : l.take (n + 1) = l.take n ++ l[n]?.toList",
"start": [
1610,
1
],
"end": [
1617,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_eq_nil_iff",
"code": "@[simp]\ntheorem take_eq_nil_iff {l : List α} {k : Nat} : l.take k = [] ↔ l = [] ∨ k = 0",
"start": [
1619,
1
],
"end": [
1621,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_eq_nil_of_eq_nil",
"code": "theorem take_eq_nil_of_eq_nil : ∀ {as : List α} {i}, as = [] → as.take i = []",
"start": [
1623,
1
],
"end": [
1624,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_nil_of_take_ne_nil",
"code": "theorem ne_nil_of_take_ne_nil {as : List α} {i : Nat} (h: as.take i ≠ []) : as ≠ []",
"start": [
1626,
1
],
"end": [
1627,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_eq_take",
"code": "theorem dropLast_eq_take (l : List α) : l.dropLast = l.take l.length.pred",
"start": [
1629,
1
],
"end": [
1635,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_eq_nil_iff_le",
"code": "@[simp]\ntheorem drop_eq_nil_iff_le {l : List α} {k : Nat} : l.drop k = [] ↔ l.length ≤ k",
"start": [
1637,
1
],
"end": [
1648,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_sizeOf_le",
"code": "theorem drop_sizeOf_le [SizeOf α] (l : List α) (n : Nat) : sizeOf (l.drop n) ≤ sizeOf l",
"start": [
1650,
1
],
"end": [
1657,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_drop",
"code": "@[simp] theorem drop_drop (n : Nat) : ∀ (m) (l : List α), drop n (drop m l) = drop (n + m) l",
"start": [
1659,
1
],
"end": [
1666,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.take_drop",
"code": "theorem take_drop : ∀ (m n : Nat) (l : List α), take n (drop m l) = drop m (take (m + n) l)",
"start": [
1668,
1
],
"end": [
1671,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_drop",
"code": "@[simp] theorem map_drop (f : α → β) :\n ∀ (L : List α) (i : Nat), (L.drop i).map f = (L.map f).drop i",
"start": [
1673,
1
],
"end": [
1679,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_cons_drop",
"code": "@[simp]\ntheorem getElem_cons_drop : ∀ (l : List α) (i : Nat) (h : i < l.length),\n l[i] :: drop (i + 1) l = drop i l",
"start": [
1681,
1
],
"end": [
1685,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_cons_drop",
"code": "@[deprecated getElem_cons_drop (since := \"2024-06-12\")]\ntheorem get_cons_drop (l : List α) (i) : get l i :: drop (i + 1) l = drop i l",
"start": [
1687,
1
],
"end": [
1689,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_eq_getElem_cons",
"code": "theorem drop_eq_getElem_cons {n} {l : List α} (h) : drop n l = l[n] :: drop (n + 1) l",
"start": [
1691,
1
],
"end": [
1692,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_eq_get_cons",
"code": "@[deprecated drop_eq_getElem_cons (since := \"2024-06-12\")]\ntheorem drop_eq_get_cons {n} {l : List α} (h) : drop n l = get l ⟨n, h⟩ :: drop (n + 1) l",
"start": [
1694,
1
],
"end": [
1696,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_eq_nil_of_eq_nil",
"code": "theorem drop_eq_nil_of_eq_nil : ∀ {as : List α} {i}, as = [] → as.drop i = []",
"start": [
1698,
1
],
"end": [
1699,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.ne_nil_of_drop_ne_nil",
"code": "theorem ne_nil_of_drop_ne_nil {as : List α} {i : Nat} (h: as.drop i ≠ []) : as ≠ []",
"start": [
1701,
1
],
"end": [
1702,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_add",
"code": "@[deprecated drop_drop (since := \"2024-06-15\")]\ntheorem drop_add (m n) (l : List α) : drop (m + n) l = drop m (drop n l)",
"start": [
1704,
1
],
"end": [
1706,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_left",
"code": "@[simp]\ntheorem drop_left : ∀ l₁ l₂ : List α, drop (length l₁) (l₁ ++ l₂) = l₂",
"start": [
1708,
1
],
"end": [
1711,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.drop_left'",
"code": "theorem drop_left' {l₁ l₂ : List α} {n} (h : length l₁ = n) : drop n (l₁ ++ l₂) = l₂",
"start": [
1713,
1
],
"end": [
1714,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_cons",
"code": "theorem takeWhile_cons (p : α → Bool) (a : α) (l : List α) :\n (a :: l).takeWhile p = if p a then a :: l.takeWhile p else []",
"start": [
1718,
1
],
"end": [
1721,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_cons",
"code": "theorem dropWhile_cons :\n (x :: xs : List α).dropWhile p = if p x then xs.dropWhile p else x :: xs",
"start": [
1723,
1
],
"end": [
1725,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_map",
"code": "theorem takeWhile_map (f : α → β) (p : β → Bool) (l : List α) :\n (l.map f).takeWhile p = (l.takeWhile (p ∘ f)).map f",
"start": [
1727,
1
],
"end": [
1733,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_map",
"code": "theorem dropWhile_map (f : α → β) (p : β → Bool) (l : List α) :\n (l.map f).dropWhile p = (l.dropWhile (p ∘ f)).map f",
"start": [
1735,
1
],
"end": [
1741,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_append_dropWhile",
"code": "@[simp] theorem takeWhile_append_dropWhile (p : α → Bool) :\n ∀ (l : List α), takeWhile p l ++ dropWhile p l = l",
"start": [
1743,
1
],
"end": [
1746,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_append",
"code": "theorem dropWhile_append {xs ys : List α} :\n (xs ++ ys).dropWhile p =\n if (xs.dropWhile p).isEmpty then ys.dropWhile p else xs.dropWhile p ++ ys",
"start": [
1748,
1
],
"end": [
1755,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_replicate_eq_filter",
"code": "@[simp] theorem takeWhile_replicate_eq_filter (p : α → Bool) :\n (replicate n a).takeWhile p = (replicate n a).filter p",
"start": [
1757,
1
],
"end": [
1763,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.takeWhile_replicate",
"code": "theorem takeWhile_replicate (p : α → Bool) :\n (replicate n a).takeWhile p = if p a then replicate n a else []",
"start": [
1765,
1
],
"end": [
1767,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_replicate_eq_filter_not",
"code": "@[simp] theorem dropWhile_replicate_eq_filter_not (p : α → Bool) :\n (replicate n a).dropWhile p = (replicate n a).filter (fun a => !p a)",
"start": [
1769,
1
],
"end": [
1775,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropWhile_replicate",
"code": "theorem dropWhile_replicate (p : α → Bool) :\n (replicate n a).dropWhile p = if p a then [] else replicate n a",
"start": [
1777,
1
],
"end": [
1780,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.partition_eq_filter_filter",
"code": "@[simp] theorem partition_eq_filter_filter (p : α → Bool) (l : List α) :\n partition p l = (filter p l, filter (not ∘ p) l)",
"start": [
1784,
1
],
"end": [
1789,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_dropLast",
"code": "@[simp] theorem length_dropLast : ∀ (xs : List α), xs.dropLast.length = xs.length - 1",
"start": [
1797,
1
],
"end": [
1799,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem_dropLast",
"code": "@[simp] theorem getElem_dropLast : ∀ (xs : List α) (i : Nat) (h : i < xs.dropLast.length),\n xs.dropLast[i] = xs[i]'(Nat.lt_of_lt_of_le h (length_dropLast .. ▸ Nat.pred_le _))",
"start": [
1801,
1
],
"end": [
1804,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get_dropLast",
"code": "@[deprecated getElem_dropLast (since := \"2024-06-12\")]\ntheorem get_dropLast (xs : List α) (i : Fin xs.dropLast.length) :\n xs.dropLast.get i = xs.get ⟨i, Nat.lt_of_lt_of_le i.isLt (length_dropLast .. ▸ Nat.pred_le _)⟩",
"start": [
1806,
1
],
"end": [
1809,
7
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_cons_of_ne_nil",
"code": "theorem dropLast_cons_of_ne_nil {α : Type u} {x : α}\n {l : List α} (h : l ≠ []) : (x :: l).dropLast = x :: l.dropLast",
"start": [
1811,
1
],
"end": [
1813,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_append_of_ne_nil",
"code": "@[simp] theorem dropLast_append_of_ne_nil {α : Type u} {l : List α} :\n ∀ (l' : List α) (_ : l ≠ []), (l' ++ l).dropLast = l' ++ l.dropLast",
"start": [
1815,
1
],
"end": [
1820,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_append_cons",
"code": "theorem dropLast_append_cons : dropLast (l₁ ++ b::l₂) = l₁ ++ dropLast (b::l₂)",
"start": [
1822,
1
],
"end": [
1823,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_concat",
"code": "@[simp 1100] theorem dropLast_concat : dropLast (l₁ ++ [b]) = l₁",
"start": [
1825,
1
],
"end": [
1825,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_dropLast",
"code": "@[simp] theorem map_dropLast (f : α → β) (l : List α) : l.dropLast.map f = (l.map f).dropLast",
"start": [
1827,
1
],
"end": [
1830,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_replicate",
"code": "@[simp] theorem dropLast_replicate (n) (a : α) : dropLast (replicate n a) = replicate (n - 1) a",
"start": [
1832,
1
],
"end": [
1839,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.dropLast_cons_self_replicate",
"code": "@[simp] theorem dropLast_cons_self_replicate (n) (a : α) :\n dropLast (a :: replicate n a) = replicate n a",
"start": [
1841,
1
],
"end": [
1843,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_cons₂_self",
"code": "@[simp] theorem isPrefixOf_cons₂_self [LawfulBEq α] {a : α} :\n isPrefixOf (a::as) (a::bs) = isPrefixOf as bs",
"start": [
1849,
1
],
"end": [
1850,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_length_pos_nil",
"code": "@[simp] theorem isPrefixOf_length_pos_nil {L : List α} (h : 0 < L.length) : isPrefixOf L [] = false",
"start": [
1852,
1
],
"end": [
1853,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isPrefixOf_replicate",
"code": "@[simp] theorem isPrefixOf_replicate {a : α} :\n isPrefixOf l (replicate n a) = (decide (l.length ≤ n) && l.all (· == a))",
"start": [
1855,
1
],
"end": [
1862,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isSuffixOf_cons_nil",
"code": "@[simp] theorem isSuffixOf_cons_nil : isSuffixOf (a::as) ([] : List α) = false",
"start": [
1870,
1
],
"end": [
1871,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.isSuffixOf_replicate",
"code": "@[simp] theorem isSuffixOf_replicate {a : α} :\n isSuffixOf l (replicate n a) = (decide (l.length ≤ n) && l.all (· == a))",
"start": [
1873,
1
],
"end": [
1875,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateLeft_zero",
"code": "@[simp] theorem rotateLeft_zero (l : List α) : rotateLeft l 0 = l",
"start": [
1881,
1
],
"end": [
1882,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.rotateRight_zero",
"code": "@[simp] theorem rotateRight_zero (l : List α) : rotateRight l 0 = l",
"start": [
1889,
1
],
"end": [
1890,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_cons_self",
"code": "@[simp] theorem replace_cons_self [LawfulBEq α] {a : α} : (a::as).replace a b = b::as",
"start": [
1901,
1
],
"end": [
1902,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_of_not_mem",
"code": "@[simp] theorem replace_of_not_mem {l : List α} (h : !l.elem a) : l.replace a b = l",
"start": [
1904,
1
],
"end": [
1905,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_replicate_self",
"code": "@[simp] theorem replace_replicate_self [LawfulBEq α] {a : α} (h : 0 < n) :\n (replicate n a).replace a b = b :: replicate (n - 1) a",
"start": [
1907,
1
],
"end": [
1909,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "List.replace_replicate_ne",
"code": "@[simp] theorem replace_replicate_ne {a b c : α} (h : !b == a) :\n (replicate n a).replace b c = replicate n a",
"start": [
1911,
1
],
"end": [
1914,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert_nil",
"code": "@[simp] theorem insert_nil (a : α) : [].insert a = [a]",
"start": [
1923,
1
],
"end": [
1924,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert_of_mem",
"code": "@[simp] theorem insert_of_mem {l : List α} (h : a ∈ l) : l.insert a = l",
"start": [
1926,
1
],
"end": [
1927,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert_of_not_mem",
"code": "@[simp] theorem insert_of_not_mem {l : List α} (h : a ∉ l) : l.insert a = a :: l",
"start": [
1929,
1
],
"end": [
1930,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_insert_iff",
"code": "@[simp] theorem mem_insert_iff {l : List α} : a ∈ l.insert b ↔ a = b ∨ a ∈ l",
"start": [
1932,
1
],
"end": [
1939,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_insert_self",
"code": "@[simp 1100] theorem mem_insert_self (a : α) (l : List α) : a ∈ l.insert a",
"start": [
1941,
1
],
"end": [
1942,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_insert_of_mem",
"code": "theorem mem_insert_of_mem {l : List α} (h : a ∈ l) : a ∈ l.insert b",
"start": [
1944,
1
],
"end": [
1945,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.eq_or_mem_of_mem_insert",
"code": "theorem eq_or_mem_of_mem_insert {l : List α} (h : a ∈ l.insert b) : a = b ∨ a ∈ l",
"start": [
1947,
1
],
"end": [
1948,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_insert_of_mem",
"code": "@[simp] theorem length_insert_of_mem {l : List α} (h : a ∈ l) :\n length (l.insert a) = length l",
"start": [
1950,
1
],
"end": [
1951,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "List.length_insert_of_not_mem",
"code": "@[simp] theorem length_insert_of_not_mem {l : List α} (h : a ∉ l) :\n length (l.insert a) = length l + 1",
"start": [
1953,
1
],
"end": [
1954,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert_replicate_self",
"code": "@[simp] theorem insert_replicate_self {a : α} (h : 0 < n) : (replicate n a).insert a = replicate n a",
"start": [
1956,
1
],
"end": [
1957,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.insert_replicate_ne",
"code": "@[simp] theorem insert_replicate_ne {a b : α} (h : !b == a) :\n (replicate n a).insert b = b :: replicate n a",
"start": [
1959,
1
],
"end": [
1962,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_cons_head",
"code": "@[simp] theorem erase_cons_head [LawfulBEq α] (a : α) (l : List α) : (a :: l).erase a = l",
"start": [
1971,
1
],
"end": [
1972,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_cons_tail",
"code": "@[simp] theorem erase_cons_tail {a b : α} (l : List α) (h : ¬(b == a)) :\n (b :: l).erase a = b :: l.erase a",
"start": [
1974,
1
],
"end": [
1975,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_of_not_mem",
"code": "theorem erase_of_not_mem [LawfulBEq α] {a : α} : ∀ {l : List α}, a ∉ l → l.erase a = l",
"start": [
1977,
1
],
"end": [
1981,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_replicate_self",
"code": "@[simp] theorem erase_replicate_self [LawfulBEq α] {a : α} :\n (replicate n a).erase a = replicate (n - 1) a",
"start": [
1983,
1
],
"end": [
1985,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.erase_replicate_ne",
"code": "@[simp] theorem erase_replicate_ne [LawfulBEq α] {a b : α} (h : !b == a) :\n (replicate n a).erase b = replicate n a",
"start": [
1987,
1
],
"end": [
1990,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_cons_of_pos",
"code": "@[simp] theorem find?_cons_of_pos (l) (h : p a) : find? p (a :: l) = some a",
"start": [
1996,
1
],
"end": [
1997,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_cons_of_neg",
"code": "@[simp] theorem find?_cons_of_neg (l) (h : ¬p a) : find? p (a :: l) = find? p l",
"start": [
1999,
1
],
"end": [
2000,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_eq_none",
"code": "@[simp] theorem find?_eq_none : find? p l = none ↔ ∀ x ∈ l, ¬ p x",
"start": [
2002,
1
],
"end": [
2003,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_some",
"code": "theorem find?_some : ∀ {l}, find? p l = some a → p a",
"start": [
2005,
1
],
"end": [
2009,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mem_of_find?_eq_some",
"code": "@[simp] theorem mem_of_find?_eq_some : ∀ {l}, find? p l = some a → a ∈ l",
"start": [
2011,
1
],
"end": [
2015,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_map",
"code": "@[simp] theorem find?_map (f : β → α) (l : List β) : find? p (l.map f) = (l.find? (p ∘ f)).map f",
"start": [
2017,
1
],
"end": [
2022,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate",
"code": "theorem find?_replicate : find? p (replicate n a) = if n = 0 then none else if p a then some a else none",
"start": [
2024,
1
],
"end": [
2027,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate_of_length_pos",
"code": "@[simp] theorem find?_replicate_of_length_pos (h : 0 < n) : find? p (replicate n a) = if p a then some a else none",
"start": [
2029,
1
],
"end": [
2030,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate_of_pos",
"code": "@[simp] theorem find?_replicate_of_pos (h : p a) : find? p (replicate n a) = if n = 0 then none else some a",
"start": [
2032,
1
],
"end": [
2033,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate_of_neg",
"code": "@[simp] theorem find?_replicate_of_neg (h : ¬ p a) : find? p (replicate n a) = none",
"start": [
2035,
1
],
"end": [
2036,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_cons_of_isSome",
"code": "@[simp] theorem findSome?_cons_of_isSome (l) (h : (f a).isSome) : findSome? f (a :: l) = f a",
"start": [
2040,
1
],
"end": [
2042,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_cons_of_isNone",
"code": "@[simp] theorem findSome?_cons_of_isNone (l) (h : (f a).isNone) : findSome? f (a :: l) = findSome? f l",
"start": [
2044,
1
],
"end": [
2046,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.exists_of_findSome?_eq_some",
"code": "theorem exists_of_findSome?_eq_some {l : List α} {f : α → Option β} (w : l.findSome? f = some b) :\n ∃ a, a ∈ l ∧ f a = b",
"start": [
2048,
1
],
"end": [
2054,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_map",
"code": "@[simp] theorem findSome?_map (f : β → γ) (l : List β) : findSome? p (l.map f) = l.findSome? (p ∘ f)",
"start": [
2056,
1
],
"end": [
2061,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_replicate",
"code": "theorem findSome?_replicate : findSome? f (replicate n a) = if n = 0 then none else f a",
"start": [
2063,
1
],
"end": [
2068,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.findSome?_replicate_of_pos",
"code": "@[simp] theorem findSome?_replicate_of_pos (h : 0 < n) : findSome? f (replicate n a) = f a",
"start": [
2070,
1
],
"end": [
2071,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate_of_isSome",
"code": "@[simp] theorem find?_replicate_of_isSome (h : (f a).isSome) : findSome? f (replicate n a) = if n = 0 then none else f a",
"start": [
2073,
1
],
"end": [
2074,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.find?_replicate_of_isNone",
"code": "@[simp] theorem find?_replicate_of_isNone (h : (f a).isNone) : findSome? f (replicate n a) = none",
"start": [
2076,
1
],
"end": [
2078,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_cons_self",
"code": "@[simp] theorem lookup_cons_self {k : α} : ((k,b)::es).lookup k = some b",
"start": [
2084,
1
],
"end": [
2085,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_replicate",
"code": "theorem lookup_replicate {k : α} :\n (replicate n (a,b)).lookup k = if n = 0 then none else if k == a then some b else none",
"start": [
2087,
1
],
"end": [
2093,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_replicate_of_pos",
"code": "theorem lookup_replicate_of_pos {k : α} (h : 0 < n) :\n (replicate n (a,b)).lookup k = if k == a then some b else none",
"start": [
2095,
1
],
"end": [
2097,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_replicate_self",
"code": "theorem lookup_replicate_self {a : α} :\n (replicate n (a, b)).lookup a = if n = 0 then none else some b",
"start": [
2099,
1
],
"end": [
2101,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_replicate_self_of_pos",
"code": "@[simp] theorem lookup_replicate_self_of_pos {a : α} (h : 0 < n) :\n (replicate n (a, b)).lookup a = some b",
"start": [
2103,
1
],
"end": [
2105,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.lookup_replicate_ne",
"code": "@[simp] theorem lookup_replicate_ne {k : α} (h : !k == a) :\n (replicate n (a,b)).lookup k = none",
"start": [
2107,
1
],
"end": [
2109,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_any_eq_all_not",
"code": "theorem not_any_eq_all_not (l : List α) (p : α → Bool) : (!l.any p) = l.all fun a => !p a",
"start": [
2117,
1
],
"end": [
2118,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.not_all_eq_any_not",
"code": "theorem not_all_eq_any_not (l : List α) (p : α → Bool) : (!l.all p) = l.any fun a => !p a",
"start": [
2120,
1
],
"end": [
2121,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.and_any_distrib_left",
"code": "theorem and_any_distrib_left (l : List α) (p : α → Bool) (q : Bool) :\n (q && l.any p) = l.any fun a => q && p a",
"start": [
2123,
1
],
"end": [
2125,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.and_any_distrib_right",
"code": "theorem and_any_distrib_right (l : List α) (p : α → Bool) (q : Bool) :\n (l.any p && q) = l.any fun a => p a && q",
"start": [
2127,
1
],
"end": [
2129,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.or_all_distrib_left",
"code": "theorem or_all_distrib_left (l : List α) (p : α → Bool) (q : Bool) :\n (q || l.all p) = l.all fun a => q || p a",
"start": [
2131,
1
],
"end": [
2133,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "List.or_all_distrib_right",
"code": "theorem or_all_distrib_right (l : List α) (p : α → Bool) (q : Bool) :\n (l.all p || q) = l.all fun a => p a || q",
"start": [
2135,
1
],
"end": [
2137,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_eq_not_all_not",
"code": "theorem any_eq_not_all_not (l : List α) (p : α → Bool) : l.any p = !l.all (!p .)",
"start": [
2139,
1
],
"end": [
2140,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_eq_not_any_not",
"code": "theorem all_eq_not_any_not (l : List α) (p : α → Bool) : l.all p = !l.any (!p .)",
"start": [
2142,
1
],
"end": [
2143,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.any_map",
"code": "theorem any_map (f : α → β) (l : List α) (p : β → Bool) : (l.map f).any p = l.any (p ∘ f)",
"start": [
2145,
1
],
"end": [
2146,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.all_map",
"code": "theorem all_map (f : α → β) (l : List α) (p : β → Bool) : (l.map f).all p = l.all (p ∘ f)",
"start": [
2148,
1
],
"end": [
2149,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_map",
"code": "theorem zip_map (f : α → γ) (g : β → δ) :\n ∀ (l₁ : List α) (l₂ : List β), zip (l₁.map f) (l₂.map g) = (zip l₁ l₂).map (Prod.map f g)",
"start": [
2155,
1
],
"end": [
2160,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_map_left",
"code": "theorem zip_map_left (f : α → γ) (l₁ : List α) (l₂ : List β) :\n zip (l₁.map f) l₂ = (zip l₁ l₂).map (Prod.map f id)",
"start": [
2162,
1
],
"end": [
2163,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_map_right",
"code": "theorem zip_map_right (f : β → γ) (l₁ : List α) (l₂ : List β) :\n zip l₁ (l₂.map f) = (zip l₁ l₂).map (Prod.map id f)",
"start": [
2165,
1
],
"end": [
2166,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_append",
"code": "theorem zip_append :\n ∀ {l₁ r₁ : List α} {l₂ r₂ : List β} (_h : length l₁ = length l₂),\n zip (l₁ ++ r₁) (l₂ ++ r₂) = zip l₁ l₂ ++ zip r₁ r₂",
"start": [
2168,
1
],
"end": [
2174,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_map'",
"code": "theorem zip_map' (f : α → β) (g : α → γ) :\n ∀ l : List α, zip (l.map f) (l.map g) = l.map fun a => (f a, g a)",
"start": [
2176,
1
],
"end": [
2179,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "List.of_mem_zip",
"code": "theorem of_mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂",
"start": [
2181,
1
],
"end": [
2187,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_fst_zip",
"code": "theorem map_fst_zip :\n ∀ (l₁ : List α) (l₂ : List β), l₁.length ≤ l₂.length → map Prod.fst (zip l₁ l₂) = l₁",
"start": [
2189,
1
],
"end": [
2196,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_snd_zip",
"code": "theorem map_snd_zip :\n ∀ (l₁ : List α) (l₂ : List β), l₂.length ≤ l₁.length → map Prod.snd (zip l₁ l₂) = l₂",
"start": [
2198,
1
],
"end": [
2207,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zip_replicate'",
"code": "@[simp] theorem zip_replicate' {a : α} {b : β} {n : Nat} :\n zip (replicate n a) (replicate n b) = replicate n (a, b)",
"start": [
2209,
1
],
"end": [
2214,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_zipWith",
"code": "theorem getElem?_zipWith {f : α → β → γ} {i : Nat} :\n (List.zipWith f as bs)[i]? = match as[i]?, bs[i]? with\n | some a, some b => some (f a b) | _, _ => none",
"start": [
2218,
1
],
"end": [
2227,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_zipWith",
"code": "@[deprecated getElem?_zipWith (since := \"2024-06-12\")]\ntheorem get?_zipWith {f : α → β → γ} :\n (List.zipWith f as bs).get? i = match as.get? i, bs.get? i with\n | some a, some b => some (f a b) | _, _ => none",
"start": [
2229,
1
],
"end": [
2233,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_get?",
"code": "@[deprecated getElem?_zipWith (since := \"2024-06-07\")] abbrev zipWith_get? := @get?_zipWith",
"start": [
2236,
1
],
"end": [
2236,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_map",
"code": "@[simp]\ntheorem zipWith_map {μ} (f : γ → δ → μ) (g : α → γ) (h : β → δ) (l₁ : List α) (l₂ : List β) :\n zipWith f (l₁.map g) (l₂.map h) = zipWith (fun a b => f (g a) (h b)) l₁ l₂",
"start": [
2238,
1
],
"end": [
2241,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_map_left",
"code": "theorem zipWith_map_left (l₁ : List α) (l₂ : List β) (f : α → α') (g : α' → β → γ) :\n zipWith g (l₁.map f) l₂ = zipWith (fun a b => g (f a) b) l₁ l₂",
"start": [
2243,
1
],
"end": [
2245,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_map_right",
"code": "theorem zipWith_map_right (l₁ : List α) (l₂ : List β) (f : β → β') (g : α → β' → γ) :\n zipWith g l₁ (l₂.map f) = zipWith (fun a b => g a (f b)) l₁ l₂",
"start": [
2247,
1
],
"end": [
2249,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_foldr_eq_zip_foldr",
"code": "theorem zipWith_foldr_eq_zip_foldr {f : α → β → γ} (i : δ):\n (zipWith f l₁ l₂).foldr g i = (zip l₁ l₂).foldr (fun p r => g (f p.1 p.2) r) i",
"start": [
2251,
1
],
"end": [
2253,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_foldl_eq_zip_foldl",
"code": "theorem zipWith_foldl_eq_zip_foldl {f : α → β → γ} (i : δ):\n (zipWith f l₁ l₂).foldl g i = (zip l₁ l₂).foldl (fun r p => g r (f p.1 p.2)) i",
"start": [
2255,
1
],
"end": [
2257,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_eq_nil_iff",
"code": "@[simp]\ntheorem zipWith_eq_nil_iff {f : α → β → γ} {l l'} : zipWith f l l' = [] ↔ l = [] ∨ l' = []",
"start": [
2259,
1
],
"end": [
2261,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_zipWith",
"code": "theorem map_zipWith {δ : Type _} (f : α → β) (g : γ → δ → α) (l : List γ) (l' : List δ) :\n map f (zipWith g l l') = zipWith (fun x y => f (g x y)) l l'",
"start": [
2263,
1
],
"end": [
2270,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_distrib_take",
"code": "theorem zipWith_distrib_take : (zipWith f l l').take n = zipWith f (l.take n) (l'.take n)",
"start": [
2272,
1
],
"end": [
2280,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_distrib_drop",
"code": "theorem zipWith_distrib_drop : (zipWith f l l').drop n = zipWith f (l.drop n) (l'.drop n)",
"start": [
2282,
1
],
"end": [
2290,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_append",
"code": "theorem zipWith_append (f : α → β → γ) (l la : List α) (l' lb : List β)\n (h : l.length = l'.length) :\n zipWith f (l ++ la) (l' ++ lb) = zipWith f l l' ++ zipWith f la lb",
"start": [
2292,
1
],
"end": [
2304,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWith_replicate'",
"code": "@[simp] theorem zipWith_replicate' {a : α} {b : β} {n : Nat} :\n zipWith f (replicate n a) (replicate n b) = replicate n (f a b)",
"start": [
2306,
1
],
"end": [
2311,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.getElem?_zipWithAll",
"code": "theorem getElem?_zipWithAll {f : Option α → Option β → γ} {i : Nat} :\n (zipWithAll f as bs)[i]? = match as[i]?, bs[i]? with\n | none, none => .none | a?, b? => some (f a? b?)",
"start": [
2315,
1
],
"end": [
2326,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.get?_zipWithAll",
"code": "@[deprecated getElem?_zipWithAll (since := \"2024-06-12\")]\ntheorem get?_zipWithAll {f : Option α → Option β → γ} :\n (zipWithAll f as bs).get? i = match as.get? i, bs.get? i with\n | none, none => .none | a?, b? => some (f a? b?)",
"start": [
2328,
1
],
"end": [
2332,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_get?",
"code": "@[deprecated getElem?_zipWithAll (since := \"2024-06-07\")] abbrev zipWithAll_get? := @get?_zipWithAll",
"start": [
2335,
1
],
"end": [
2335,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_map",
"code": "theorem zipWithAll_map {μ} (f : Option γ → Option δ → μ) (g : α → γ) (h : β → δ) (l₁ : List α) (l₂ : List β) :\n zipWithAll f (l₁.map g) (l₂.map h) = zipWithAll (fun a b => f (g <$> a) (h <$> b)) l₁ l₂",
"start": [
2337,
1
],
"end": [
2339,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_map_left",
"code": "theorem zipWithAll_map_left (l₁ : List α) (l₂ : List β) (f : α → α') (g : Option α' → Option β → γ) :\n zipWithAll g (l₁.map f) l₂ = zipWithAll (fun a b => g (f <$> a) b) l₁ l₂",
"start": [
2341,
1
],
"end": [
2343,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_map_right",
"code": "theorem zipWithAll_map_right (l₁ : List α) (l₂ : List β) (f : β → β') (g : Option α → Option β' → γ) :\n zipWithAll g l₁ (l₂.map f) = zipWithAll (fun a b => g a (f <$> b)) l₁ l₂",
"start": [
2345,
1
],
"end": [
2347,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_zipWithAll",
"code": "theorem map_zipWithAll {δ : Type _} (f : α → β) (g : Option γ → Option δ → α) (l : List γ) (l' : List δ) :\n map f (zipWithAll g l l') = zipWithAll (fun x y => f (g x y)) l l'",
"start": [
2349,
1
],
"end": [
2354,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "List.zipWithAll_replicate",
"code": "@[simp] theorem zipWithAll_replicate {a : α} {b : β} {n : Nat} :\n zipWithAll f (replicate n a) (replicate n b) = replicate n (f a b)",
"start": [
2356,
1
],
"end": [
2360,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.unzip_replicate",
"code": "@[simp] theorem unzip_replicate {n : Nat} {a : α} {b : β} :\n unzip (replicate n (a, b)) = (replicate n a, replicate n b)",
"start": [
2364,
1
],
"end": [
2368,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enumFrom_length",
"code": "@[simp] theorem enumFrom_length : ∀ {n} {l : List α}, (enumFrom n l).length = l.length",
"start": [
2374,
1
],
"end": [
2376,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_enumFrom",
"code": "theorem map_enumFrom (f : α → β) (n : Nat) (l : List α) :\n map (Prod.map id f) (enumFrom n l) = enumFrom n (map f l)",
"start": [
2378,
1
],
"end": [
2380,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enum_length",
"code": "@[simp] theorem enum_length : (enum l).length = l.length",
"start": [
2384,
1
],
"end": [
2385,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "List.enum_cons",
"code": "theorem enum_cons : (a::as).enum = (0, a) :: as.enumFrom 1",
"start": [
2387,
1
],
"end": [
2387,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "List.map_enum",
"code": "theorem map_enum (f : α → β) (l : List α) : map (Prod.map id f) (enum l) = enum (map f l)",
"start": [
2389,
1
],
"end": [
2390,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_nil",
"code": "@[simp] theorem minimum?_nil [Min α] : ([] : List α).minimum? = none",
"start": [
2396,
1
],
"end": [
2396,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_cons",
"code": "theorem minimum?_cons [Min α] {xs : List α} : (x :: xs).minimum? = foldl min x xs",
"start": [
2400,
1
],
"end": [
2400,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_eq_none_iff",
"code": "@[simp] theorem minimum?_eq_none_iff {xs : List α} [Min α] : xs.minimum? = none ↔ xs = []",
"start": [
2402,
1
],
"end": [
2403,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_mem",
"code": "theorem minimum?_mem [Min α] (min_eq_or : ∀ a b : α, min a b = a ∨ min a b = b) :\n {xs : List α} → xs.minimum? = some a → a ∈ xs",
"start": [
2405,
1
],
"end": [
2423,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "List.le_minimum?_iff",
"code": "theorem le_minimum?_iff [Min α] [LE α]\n (le_min_iff : ∀ a b c : α, a ≤ min b c ↔ a ≤ b ∧ a ≤ c) :\n {xs : List α} → xs.minimum? = some a → ∀ x, x ≤ a ↔ ∀ b, b ∈ xs → x ≤ b",
"start": [
2425,
1
],
"end": [
2439,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_eq_some_iff",
"code": "theorem minimum?_eq_some_iff [Min α] [LE α] [anti : Antisymm ((· : α) ≤ ·)]\n (le_refl : ∀ a : α, a ≤ a)\n (min_eq_or : ∀ a b : α, min a b = a ∨ min a b = b)\n (le_min_iff : ∀ a b c : α, a ≤ min b c ↔ a ≤ b ∧ a ≤ c) {xs : List α} :\n xs.minimum? = some a ↔ a ∈ xs ∧ ∀ b, b ∈ xs → a ≤ b",
"start": [
2443,
1
],
"end": [
2455,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_replicate",
"code": "theorem minimum?_replicate [Min α] {n : Nat} {a : α} (w : min a a = a) :\n (replicate n a).minimum? = if n = 0 then none else some a",
"start": [
2457,
1
],
"end": [
2461,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.minimum?_replicate_of_pos",
"code": "@[simp] theorem minimum?_replicate_of_pos [Min α] {n : Nat} {a : α} (w : min a a = a) (h : 0 < n) :\n (replicate n a).minimum? = some a",
"start": [
2463,
1
],
"end": [
2465,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_nil",
"code": "@[simp] theorem maximum?_nil [Max α] : ([] : List α).maximum? = none",
"start": [
2469,
1
],
"end": [
2469,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_cons",
"code": "theorem maximum?_cons [Max α] {xs : List α} : (x :: xs).maximum? = foldl max x xs",
"start": [
2473,
1
],
"end": [
2473,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_eq_none_iff",
"code": "@[simp] theorem maximum?_eq_none_iff {xs : List α} [Max α] : xs.maximum? = none ↔ xs = []",
"start": [
2475,
1
],
"end": [
2476,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_mem",
"code": "theorem maximum?_mem [Max α] (min_eq_or : ∀ a b : α, max a b = a ∨ max a b = b) :\n {xs : List α} → xs.maximum? = some a → a ∈ xs",
"start": [
2478,
1
],
"end": [
2486,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_le_iff",
"code": "theorem maximum?_le_iff [Max α] [LE α]\n (max_le_iff : ∀ a b c : α, max b c ≤ a ↔ b ≤ a ∧ c ≤ a) :\n {xs : List α} → xs.maximum? = some a → ∀ x, a ≤ x ↔ ∀ b ∈ xs, b ≤ x",
"start": [
2488,
1
],
"end": [
2496,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_eq_some_iff",
"code": "theorem maximum?_eq_some_iff [Max α] [LE α] [anti : Antisymm ((· : α) ≤ ·)]\n (le_refl : ∀ a : α, a ≤ a)\n (max_eq_or : ∀ a b : α, max a b = a ∨ max a b = b)\n (max_le_iff : ∀ a b c : α, max b c ≤ a ↔ b ≤ a ∧ c ≤ a) {xs : List α} :\n xs.maximum? = some a ↔ a ∈ xs ∧ ∀ b ∈ xs, b ≤ a",
"start": [
2500,
1
],
"end": [
2512,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_replicate",
"code": "theorem maximum?_replicate [Max α] {n : Nat} {a : α} (w : max a a = a) :\n (replicate n a).maximum? = if n = 0 then none else some a",
"start": [
2514,
1
],
"end": [
2518,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "List.maximum?_replicate_of_pos",
"code": "@[simp] theorem maximum?_replicate_of_pos [Max α] {n : Nat} {a : α} (w : max a a = a) (h : 0 < n) :\n (replicate n a).maximum? = some a",
"start": [
2520,
1
],
"end": [
2522,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM'",
"code": "def mapM' [Monad m] (f : α → m β) : List α → m (List β)\n | [] => pure []\n | a :: l => return (← f a) :: (← l.mapM' f)",
"start": [
2528,
1
],
"end": [
2531,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM'_nil",
"code": "@[simp] theorem mapM'_nil [Monad m] {f : α → m β} : mapM' f [] = pure []",
"start": [
2533,
1
],
"end": [
2533,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM'_cons",
"code": "@[simp] theorem mapM'_cons [Monad m] {f : α → m β} :\n mapM' f (a :: l) = return ((← f a) :: (← l.mapM' f))",
"start": [
2534,
1
],
"end": [
2536,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM'_eq_mapM",
"code": "theorem mapM'_eq_mapM [Monad m] [LawfulMonad m] (f : α → m β) (l : List α) :\n mapM' f l = mapM f l",
"start": [
2538,
1
],
"end": [
2542,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM_nil",
"code": "@[simp] theorem mapM_nil [Monad m] (f : α → m β) : [].mapM f = pure []",
"start": [
2544,
1
],
"end": [
2544,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM_cons",
"code": "@[simp] theorem mapM_cons [Monad m] [LawfulMonad m] (f : α → m β) :\n (a :: l).mapM f = (return (← f a) :: (← l.mapM f))",
"start": [
2546,
1
],
"end": [
2547,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.mapM_append",
"code": "@[simp] theorem mapM_append [Monad m] [LawfulMonad m] (f : α → m β) {l₁ l₂ : List α} :\n (l₁ ++ l₂).mapM f = (return (← l₁.mapM f) ++ (← l₂.mapM f))",
"start": [
2549,
1
],
"end": [
2550,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forM_nil'",
"code": "@[simp] theorem forM_nil' [Monad m] : ([] : List α).forM f = (pure .unit : m PUnit)",
"start": [
2557,
1
],
"end": [
2557,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "List.forM_cons'",
"code": "@[simp] theorem forM_cons' [Monad m] :\n (a::as).forM f = (f a >>= fun _ => as.forM f : m PUnit)",
"start": [
2559,
1
],
"end": [
2561,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/IntList.lean | [
".lake/packages/lean4/src/lean/Init/Data/List/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/DivModLemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Gcd.lean"
] | [
{
"full_name": "Lean.Omega.IntList",
"code": "abbrev IntList := List Int",
"start": [
13,
1
],
"end": [
19,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get",
"code": "def get (xs : IntList) (i : Nat) : Int := (xs.get? i).getD 0",
"start": [
23,
1
],
"end": [
24,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get_nil",
"code": "@[simp] theorem get_nil : get ([] : IntList) i = 0",
"start": [
26,
1
],
"end": [
26,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get_cons_zero",
"code": "@[simp] theorem get_cons_zero : get (x :: xs) 0 = x",
"start": [
27,
1
],
"end": [
27,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get_cons_succ",
"code": "@[simp] theorem get_cons_succ : get (x :: xs) (i+1) = get xs i",
"start": [
28,
1
],
"end": [
28,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get_map",
"code": "theorem get_map {xs : IntList} (h : f 0 = 0) : get (xs.map f) i = f (xs.get i)",
"start": [
30,
1
],
"end": [
32,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.get_of_length_le",
"code": "theorem get_of_length_le {xs : IntList} (h : xs.length ≤ i) : xs.get i = 0",
"start": [
34,
1
],
"end": [
36,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.set",
"code": "def set (xs : IntList) (i : Nat) (y : Int) : IntList :=\n match xs, i with\n | [], 0 => [y]\n | [], (i+1) => 0 :: set [] i y\n | _ :: xs, 0 => y :: xs\n | x :: xs, (i+1) => x :: set xs i y",
"start": [
42,
1
],
"end": [
48,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.set_nil_zero",
"code": "@[simp] theorem set_nil_zero : set [] 0 y = [y]",
"start": [
50,
1
],
"end": [
50,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.set_nil_succ",
"code": "@[simp] theorem set_nil_succ : set [] (i+1) y = 0 :: set [] i y",
"start": [
51,
1
],
"end": [
51,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.set_cons_zero",
"code": "@[simp] theorem set_cons_zero : set (x :: xs) 0 y = y :: xs",
"start": [
52,
1
],
"end": [
52,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.set_cons_succ",
"code": "@[simp] theorem set_cons_succ : set (x :: xs) (i+1) y = x :: set xs i y",
"start": [
53,
1
],
"end": [
53,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.leading",
"code": "def leading (xs : IntList) : Int := xs.find? (! · == 0) |>.getD 0",
"start": [
55,
1
],
"end": [
56,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.add",
"code": "def add (xs ys : IntList) : IntList :=\n List.zipWithAll (fun x y => x.getD 0 + y.getD 0) xs ys",
"start": [
58,
1
],
"end": [
60,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.add_def",
"code": "theorem add_def (xs ys : IntList) :\n xs + ys = List.zipWithAll (fun x y => x.getD 0 + y.getD 0) xs ys",
"start": [
64,
1
],
"end": [
66,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.add_get",
"code": "@[simp] theorem add_get (xs ys : IntList) (i : Nat) : (xs + ys).get i = xs.get i + ys.get i",
"start": [
68,
1
],
"end": [
70,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.add_nil",
"code": "@[simp] theorem add_nil (xs : IntList) : xs + [] = xs",
"start": [
72,
1
],
"end": [
72,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.nil_add",
"code": "@[simp] theorem nil_add (xs : IntList) : [] + xs = xs",
"start": [
73,
1
],
"end": [
73,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.cons_add_cons",
"code": "@[simp] theorem cons_add_cons (x) (xs : IntList) (y) (ys : IntList) :\n (x :: xs) + (y :: ys) = (x + y) :: (xs + ys)",
"start": [
74,
1
],
"end": [
75,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul",
"code": "def mul (xs ys : IntList) : IntList := List.zipWith (· * ·) xs ys",
"start": [
77,
1
],
"end": [
78,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_def",
"code": "theorem mul_def (xs ys : IntList) : xs * ys = List.zipWith (· * ·) xs ys",
"start": [
82,
1
],
"end": [
83,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_get",
"code": "@[simp] theorem mul_get (xs ys : IntList) (i : Nat) : (xs * ys).get i = xs.get i * ys.get i",
"start": [
85,
1
],
"end": [
87,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_nil_left",
"code": "@[simp] theorem mul_nil_left : ([] : IntList) * ys = []",
"start": [
89,
1
],
"end": [
89,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_nil_right",
"code": "@[simp] theorem mul_nil_right : xs * ([] : IntList) = []",
"start": [
90,
1
],
"end": [
90,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_cons₂",
"code": "@[simp] theorem mul_cons₂ : (x::xs : IntList) * (y::ys) = (x * y) :: (xs * ys)",
"start": [
91,
1
],
"end": [
91,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.neg",
"code": "def neg (xs : IntList) : IntList := xs.map fun x => -x",
"start": [
93,
1
],
"end": [
94,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.neg_def",
"code": "theorem neg_def (xs : IntList) : - xs = xs.map fun x => -x",
"start": [
98,
1
],
"end": [
98,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.neg_get",
"code": "@[simp] theorem neg_get (xs : IntList) (i : Nat) : (- xs).get i = - xs.get i",
"start": [
100,
1
],
"end": [
102,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.neg_nil",
"code": "@[simp] theorem neg_nil : (- ([] : IntList)) = []",
"start": [
104,
1
],
"end": [
104,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.neg_cons",
"code": "@[simp] theorem neg_cons : (- (x::xs : IntList)) = -x :: -xs",
"start": [
105,
1
],
"end": [
105,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sub",
"code": "def sub (xs ys : IntList) : IntList :=\n List.zipWithAll (fun x y => x.getD 0 - y.getD 0) xs ys",
"start": [
107,
1
],
"end": [
109,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sub_def",
"code": "theorem sub_def (xs ys : IntList) :\n xs - ys = List.zipWithAll (fun x y => x.getD 0 - y.getD 0) xs ys",
"start": [
113,
1
],
"end": [
115,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.smul",
"code": "def smul (xs : IntList) (i : Int) : IntList :=\n xs.map fun x => i * x",
"start": [
117,
1
],
"end": [
119,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.smul_def",
"code": "theorem smul_def (xs : IntList) (i : Int) : i * xs = xs.map fun x => i * x",
"start": [
124,
1
],
"end": [
124,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.smul_get",
"code": "@[simp] theorem smul_get (xs : IntList) (a : Int) (i : Nat) : (a * xs).get i = a * xs.get i",
"start": [
126,
1
],
"end": [
128,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.smul_nil",
"code": "@[simp] theorem smul_nil {i : Int} : i * ([] : IntList) = []",
"start": [
130,
1
],
"end": [
130,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.smul_cons",
"code": "@[simp] theorem smul_cons {i : Int} : i * (x::xs : IntList) = i * x :: i * xs",
"start": [
131,
1
],
"end": [
131,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.combo",
"code": "def combo (a : Int) (xs : IntList) (b : Int) (ys : IntList) : IntList :=\n List.zipWithAll (fun x y => a * x.getD 0 + b * y.getD 0) xs ys",
"start": [
133,
1
],
"end": [
135,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.combo_eq_smul_add_smul",
"code": "theorem combo_eq_smul_add_smul (a : Int) (xs : IntList) (b : Int) (ys : IntList) :\n combo a xs b ys = a * xs + b * ys",
"start": [
137,
1
],
"end": [
145,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_distrib_left",
"code": "theorem mul_distrib_left (xs ys zs : IntList) : (xs + ys) * zs = xs * zs + ys * zs",
"start": [
148,
1
],
"end": [
163,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_neg_left",
"code": "theorem mul_neg_left (xs ys : IntList) : (-xs) * ys = -(xs * ys)",
"start": [
165,
1
],
"end": [
171,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sub_eq_add_neg",
"code": "theorem sub_eq_add_neg (xs ys : IntList) : xs - ys = xs + (-ys)",
"start": [
174,
1
],
"end": [
180,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.mul_smul_left",
"code": "@[simp] theorem mul_smul_left {i : Int} {xs ys : IntList} : (i * xs) * ys = i * (xs * ys)",
"start": [
182,
1
],
"end": [
188,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum",
"code": "def sum (xs : IntList) : Int := xs.foldr (· + ·) 0",
"start": [
190,
1
],
"end": [
191,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum_nil",
"code": "@[simp] theorem sum_nil : sum ([] : IntList) = 0",
"start": [
193,
1
],
"end": [
193,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum_cons",
"code": "@[simp] theorem sum_cons : sum (x::xs : IntList) = x + sum xs",
"start": [
194,
1
],
"end": [
194,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum_add",
"code": "theorem sum_add (xs ys : IntList) : (xs + ys).sum = xs.sum + ys.sum",
"start": [
197,
1
],
"end": [
203,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum_neg",
"code": "@[simp]\ntheorem sum_neg (xs : IntList) : (-xs).sum = -(xs.sum)",
"start": [
205,
1
],
"end": [
209,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sum_smul",
"code": "@[simp]\ntheorem sum_smul (i : Int) (xs : IntList) : (i * xs).sum = i * (xs.sum)",
"start": [
211,
1
],
"end": [
215,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot",
"code": "def dot (xs ys : IntList) : Int := (xs * ys).sum",
"start": [
217,
1
],
"end": [
218,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_nil_left",
"code": "@[local simp] theorem dot_nil_left : dot ([] : IntList) ys = 0",
"start": [
223,
1
],
"end": [
223,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_nil_right",
"code": "@[simp] theorem dot_nil_right : dot xs ([] : IntList) = 0",
"start": [
224,
1
],
"end": [
224,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_cons₂",
"code": "@[simp] theorem dot_cons₂ : dot (x::xs) (y::ys) = x * y + dot xs ys",
"start": [
225,
1
],
"end": [
225,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_set_left",
"code": "@[simp] theorem dot_set_left (xs ys : IntList) (i : Nat) (z : Int) :\n dot (xs.set i z) ys = dot xs ys + (z - xs.get i) * ys.get i",
"start": [
230,
1
],
"end": [
248,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_distrib_left",
"code": "theorem dot_distrib_left (xs ys zs : IntList) : (xs + ys).dot zs = xs.dot zs + ys.dot zs",
"start": [
250,
1
],
"end": [
251,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_neg_left",
"code": "@[simp] theorem dot_neg_left (xs ys : IntList) : (-xs).dot ys = -(xs.dot ys)",
"start": [
253,
1
],
"end": [
254,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_smul_left",
"code": "@[simp] theorem dot_smul_left (xs ys : IntList) (i : Int) : (i * xs).dot ys = i * xs.dot ys",
"start": [
256,
1
],
"end": [
257,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_of_left_zero",
"code": "theorem dot_of_left_zero (w : ∀ x, x ∈ xs → x = 0) : dot xs ys = 0",
"start": [
259,
1
],
"end": [
270,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sdiv",
"code": "def sdiv (xs : IntList) (g : Int) : IntList := xs.map fun x => x / g",
"start": [
272,
1
],
"end": [
273,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sdiv_nil",
"code": "@[simp] theorem sdiv_nil : sdiv [] g = []",
"start": [
275,
1
],
"end": [
275,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.sdiv_cons",
"code": "@[simp] theorem sdiv_cons : sdiv (x::xs) g = (x / g) :: sdiv xs g",
"start": [
276,
1
],
"end": [
276,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd",
"code": "def gcd (xs : IntList) : Nat := xs.foldr (fun x g => Nat.gcd x.natAbs g) 0",
"start": [
278,
1
],
"end": [
279,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_nil",
"code": "@[simp] theorem gcd_nil : gcd [] = 0",
"start": [
281,
1
],
"end": [
281,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_cons",
"code": "@[simp] theorem gcd_cons : gcd (x :: xs) = Nat.gcd x.natAbs (gcd xs)",
"start": [
282,
1
],
"end": [
282,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_cons_div_left",
"code": "theorem gcd_cons_div_left : (gcd (x::xs) : Int) ∣ x",
"start": [
284,
1
],
"end": [
286,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_cons_div_right",
"code": "theorem gcd_cons_div_right : gcd (x::xs) ∣ gcd xs",
"start": [
288,
1
],
"end": [
290,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_cons_div_right'",
"code": "theorem gcd_cons_div_right' : (gcd (x::xs) : Int) ∣ (gcd xs : Int)",
"start": [
292,
1
],
"end": [
294,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_dvd",
"code": "theorem gcd_dvd (xs : IntList) {a : Int} (m : a ∈ xs) : (xs.gcd : Int) ∣ a",
"start": [
296,
1
],
"end": [
304,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dvd_gcd",
"code": "theorem dvd_gcd (xs : IntList) (c : Nat) (w : ∀ {a : Int}, a ∈ xs → (c : Int) ∣ a) :\n c ∣ xs.gcd",
"start": [
306,
1
],
"end": [
319,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_eq_iff",
"code": "theorem gcd_eq_iff (xs : IntList) (g : Nat) :\n xs.gcd = g ↔\n (∀ {a : Int}, a ∈ xs → (g : Int) ∣ a) ∧\n (∀ (c : Nat), (∀ {a : Int}, a ∈ xs → (c : Int) ∣ a) → c ∣ g)",
"start": [
321,
1
],
"end": [
333,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_eq_zero",
"code": "@[simp] theorem gcd_eq_zero (xs : IntList) : xs.gcd = 0 ↔ ∀ x, x ∈ xs → x = 0",
"start": [
337,
1
],
"end": [
338,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_mod_gcd_left",
"code": "@[simp] theorem dot_mod_gcd_left (xs ys : IntList) : dot xs ys % xs.gcd = 0",
"start": [
340,
1
],
"end": [
350,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.gcd_dvd_dot_left",
"code": "theorem gcd_dvd_dot_left (xs ys : IntList) : (xs.gcd : Int) ∣ dot xs ys",
"start": [
352,
1
],
"end": [
353,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_eq_zero_of_left_eq_zero",
"code": "@[simp]\ntheorem dot_eq_zero_of_left_eq_zero {xs ys : IntList} (h : ∀ x, x ∈ xs → x = 0) : dot xs ys = 0",
"start": [
355,
1
],
"end": [
364,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dot_sdiv_left",
"code": "theorem dot_sdiv_left (xs ys : IntList) {d : Int} (h : d ∣ xs.gcd) :\n dot (xs.sdiv d) ys = (dot xs ys) / d",
"start": [
366,
1
],
"end": [
377,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.bmod",
"code": "abbrev bmod (x : IntList) (m : Nat) : IntList := x.map (Int.bmod · m)",
"start": [
379,
1
],
"end": [
380,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.bmod_length",
"code": "theorem bmod_length (x : IntList) (m) : (bmod x m).length ≤ x.length",
"start": [
382,
1
],
"end": [
383,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.bmod_dot_sub_dot_bmod",
"code": "abbrev bmod_dot_sub_dot_bmod (m : Nat) (a b : IntList) : Int :=\n (Int.bmod (dot a b) m) - dot (bmod a m) b",
"start": [
385,
1
],
"end": [
390,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.IntList.dvd_bmod_dot_sub_dot_bmod",
"code": "theorem dvd_bmod_dot_sub_dot_bmod (m : Nat) (xs ys : IntList) :\n (m : Int) ∣ bmod_dot_sub_dot_bmod m xs ys",
"start": [
392,
1
],
"end": [
410,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/Coeffs.lean | [
".lake/packages/lean4/src/lean/Init/Omega/IntList.lean"
] | [
{
"full_name": "Lean.Omega.Coeffs",
"code": "abbrev Coeffs := IntList",
"start": [
31,
1
],
"end": [
32,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.toList",
"code": "abbrev toList (xs : Coeffs) : List Int := xs",
"start": [
36,
1
],
"end": [
37,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.ofList",
"code": "abbrev ofList (xs : List Int) : Coeffs := xs",
"start": [
38,
1
],
"end": [
39,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.isZero",
"code": "abbrev isZero (xs : Coeffs) : Prop := ∀ x, x ∈ xs → x = 0",
"start": [
40,
1
],
"end": [
41,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.set",
"code": "abbrev set (xs : Coeffs) (i : Nat) (y : Int) : Coeffs := IntList.set xs i y",
"start": [
42,
1
],
"end": [
43,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.get",
"code": "abbrev get (xs : Coeffs) (i : Nat) : Int := IntList.get xs i",
"start": [
44,
1
],
"end": [
45,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.gcd",
"code": "abbrev gcd (xs : Coeffs) : Nat := IntList.gcd xs",
"start": [
46,
1
],
"end": [
47,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.smul",
"code": "abbrev smul (xs : Coeffs) (g : Int) : Coeffs := IntList.smul xs g",
"start": [
48,
1
],
"end": [
49,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.sdiv",
"code": "abbrev sdiv (xs : Coeffs) (g : Int) : Coeffs := IntList.sdiv xs g",
"start": [
50,
1
],
"end": [
51,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot",
"code": "abbrev dot (xs ys : Coeffs) : Int := IntList.dot xs ys",
"start": [
52,
1
],
"end": [
53,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.add",
"code": "abbrev add (xs ys : Coeffs) : Coeffs := IntList.add xs ys",
"start": [
54,
1
],
"end": [
55,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.sub",
"code": "abbrev sub (xs ys : Coeffs) : Coeffs := IntList.sub xs ys",
"start": [
56,
1
],
"end": [
57,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.neg",
"code": "abbrev neg (xs : Coeffs) : Coeffs := IntList.neg xs",
"start": [
58,
1
],
"end": [
59,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.combo",
"code": "abbrev combo (a : Int) (xs : Coeffs) (b : Int) (ys : Coeffs) : Coeffs := IntList.combo a xs b ys",
"start": [
60,
1
],
"end": [
61,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.length",
"code": "abbrev length (xs : Coeffs) := List.length xs",
"start": [
62,
1
],
"end": [
63,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.leading",
"code": "abbrev leading (xs : Coeffs) : Int := IntList.leading xs",
"start": [
64,
1
],
"end": [
65,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.map",
"code": "abbrev map (f : Int → Int) (xs : Coeffs) : Coeffs := List.map f xs",
"start": [
66,
1
],
"end": [
67,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.findIdx?",
"code": "abbrev findIdx? (f : Int → Bool) (xs : Coeffs) : Option Nat :=\n xs.enum.find? (f ·.2) |>.map (·.1)",
"start": [
68,
1
],
"end": [
72,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.bmod",
"code": "abbrev bmod (x : Coeffs) (m : Nat) : Coeffs := IntList.bmod x m",
"start": [
73,
1
],
"end": [
74,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.bmod_dot_sub_dot_bmod",
"code": "abbrev bmod_dot_sub_dot_bmod (m : Nat) (a b : Coeffs) : Int :=\n IntList.bmod_dot_sub_dot_bmod m a b",
"start": [
75,
1
],
"end": [
77,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.bmod_length",
"code": "theorem bmod_length (x : Coeffs) (m : Nat) : (bmod x m).length ≤ x.length",
"start": [
78,
1
],
"end": [
79,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dvd_bmod_dot_sub_dot_bmod",
"code": "theorem dvd_bmod_dot_sub_dot_bmod (m : Nat) (xs ys : Coeffs) :\n (m : Int) ∣ bmod_dot_sub_dot_bmod m xs ys",
"start": [
80,
1
],
"end": [
81,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.get_of_length_le",
"code": "theorem get_of_length_le {i : Nat} {xs : Coeffs} (h : length xs ≤ i) : get xs i = 0",
"start": [
83,
1
],
"end": [
84,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_set_left",
"code": "theorem dot_set_left (xs ys : Coeffs) (i : Nat) (z : Int) :\n dot (set xs i z) ys = dot xs ys + (z - get xs i) * get ys i",
"start": [
85,
1
],
"end": [
87,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_sdiv_left",
"code": "theorem dot_sdiv_left (xs ys : Coeffs) {d : Int} (h : d ∣ xs.gcd) :\n dot (xs.sdiv d) ys = (dot xs ys) / d",
"start": [
88,
1
],
"end": [
90,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_smul_left",
"code": "theorem dot_smul_left (xs ys : Coeffs) (i : Int) : dot (i * xs) ys = i * dot xs ys",
"start": [
91,
1
],
"end": [
92,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_distrib_left",
"code": "theorem dot_distrib_left (xs ys zs : Coeffs) : (xs + ys).dot zs = xs.dot zs + ys.dot zs",
"start": [
93,
1
],
"end": [
94,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.sub_eq_add_neg",
"code": "theorem sub_eq_add_neg (xs ys : Coeffs) : xs - ys = xs + -ys",
"start": [
95,
1
],
"end": [
96,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.combo_eq_smul_add_smul",
"code": "theorem combo_eq_smul_add_smul (a : Int) (xs : Coeffs) (b : Int) (ys : Coeffs) :\n combo a xs b ys = (a * xs) + (b * ys)",
"start": [
97,
1
],
"end": [
99,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.gcd_dvd_dot_left",
"code": "theorem gcd_dvd_dot_left (xs ys : Coeffs) : (gcd xs : Int) ∣ dot xs ys",
"start": [
100,
1
],
"end": [
101,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.map_length",
"code": "theorem map_length {xs : Coeffs} : (xs.map f).length ≤ xs.length",
"start": [
102,
1
],
"end": [
103,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_nil_right",
"code": "theorem dot_nil_right {xs : Coeffs} : dot xs .nil = 0",
"start": [
105,
1
],
"end": [
105,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.get_nil",
"code": "theorem get_nil : get .nil i = 0",
"start": [
106,
1
],
"end": [
106,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Coeffs.dot_neg_left",
"code": "theorem dot_neg_left (xs ys : IntList) : dot (-xs) ys = -dot xs ys",
"start": [
107,
1
],
"end": [
108,
29
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/LinearCombo.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Macro.lean",
".lake/packages/lean4/src/lean/Init/Omega/Coeffs.lean"
] | [
{
"full_name": "Lean.Omega.LinearCombo",
"code": "structure LinearCombo where\n \n const : Int := 0\n \n coeffs : Coeffs := []\nderiving DecidableEq, Repr",
"start": [
19,
1
],
"end": [
25,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.ext",
"code": "theorem ext {a b : LinearCombo} (w₁ : a.const = b.const) (w₂ : a.coeffs = b.coeffs) :\n a = b",
"start": [
35,
1
],
"end": [
39,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.eval",
"code": "def eval (lc : LinearCombo) (values : Coeffs) : Int :=\n lc.const + lc.coeffs.dot values",
"start": [
41,
1
],
"end": [
46,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.eval_nil",
"code": "@[simp] theorem eval_nil : (lc : LinearCombo).eval .nil = lc.const",
"start": [
48,
1
],
"end": [
49,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate",
"code": "def coordinate (i : Nat) : LinearCombo where\n const := 0\n coeffs := Coeffs.set .nil i 1",
"start": [
51,
1
],
"end": [
54,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval",
"code": "@[simp] theorem coordinate_eval (i : Nat) (v : Coeffs) :\n (coordinate i).eval v = v.get i",
"start": [
56,
1
],
"end": [
58,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_0",
"code": "theorem coordinate_eval_0 : (coordinate 0).eval (.ofList (a0 :: t)) = a0",
"start": [
60,
1
],
"end": [
60,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_1",
"code": "theorem coordinate_eval_1 : (coordinate 1).eval (.ofList (a0 :: a1 :: t)) = a1",
"start": [
61,
1
],
"end": [
61,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_2",
"code": "theorem coordinate_eval_2 : (coordinate 2).eval (.ofList (a0 :: a1 :: a2 :: t)) = a2",
"start": [
62,
1
],
"end": [
62,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_3",
"code": "theorem coordinate_eval_3 :\n (coordinate 3).eval (.ofList (a0 :: a1 :: a2 :: a3 :: t)) = a3",
"start": [
63,
1
],
"end": [
64,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_4",
"code": "theorem coordinate_eval_4 :\n (coordinate 4).eval (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: t)) = a4",
"start": [
65,
1
],
"end": [
66,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_5",
"code": "theorem coordinate_eval_5 :\n (coordinate 5).eval (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: t)) = a5",
"start": [
67,
1
],
"end": [
68,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_6",
"code": "theorem coordinate_eval_6 :\n (coordinate 6).eval (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: t)) = a6",
"start": [
69,
1
],
"end": [
70,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_7",
"code": "theorem coordinate_eval_7 :\n (coordinate 7).eval\n (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: a7 :: t)) = a7",
"start": [
71,
1
],
"end": [
73,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_8",
"code": "theorem coordinate_eval_8 :\n (coordinate 8).eval\n (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: a7 :: a8 :: t)) = a8",
"start": [
74,
1
],
"end": [
76,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.coordinate_eval_9",
"code": "theorem coordinate_eval_9 :\n (coordinate 9).eval\n (.ofList (a0 :: a1 :: a2 :: a3 :: a4 :: a5 :: a6 :: a7 :: a8 :: a9 :: t)) = a9",
"start": [
77,
1
],
"end": [
79,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.add",
"code": "def add (l₁ l₂ : LinearCombo) : LinearCombo where\n const := l₁.const + l₂.const\n coeffs := l₁.coeffs + l₂.coeffs",
"start": [
81,
1
],
"end": [
84,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.add_const",
"code": "@[simp] theorem add_const {l₁ l₂ : LinearCombo} : (l₁ + l₂).const = l₁.const + l₂.const",
"start": [
88,
1
],
"end": [
88,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.add_coeffs",
"code": "@[simp] theorem add_coeffs {l₁ l₂ : LinearCombo} : (l₁ + l₂).coeffs = l₁.coeffs + l₂.coeffs",
"start": [
89,
1
],
"end": [
89,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.sub",
"code": "def sub (l₁ l₂ : LinearCombo) : LinearCombo where\n const := l₁.const - l₂.const\n coeffs := l₁.coeffs - l₂.coeffs",
"start": [
91,
1
],
"end": [
94,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.sub_const",
"code": "@[simp] theorem sub_const {l₁ l₂ : LinearCombo} : (l₁ - l₂).const = l₁.const - l₂.const",
"start": [
98,
1
],
"end": [
98,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.sub_coeffs",
"code": "@[simp] theorem sub_coeffs {l₁ l₂ : LinearCombo} : (l₁ - l₂).coeffs = l₁.coeffs - l₂.coeffs",
"start": [
99,
1
],
"end": [
99,
99
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.neg",
"code": "def neg (lc : LinearCombo) : LinearCombo where\n const := -lc.const\n coeffs := -lc.coeffs",
"start": [
101,
1
],
"end": [
104,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.neg_const",
"code": "@[simp] theorem neg_const {l : LinearCombo} : (-l).const = -l.const",
"start": [
108,
1
],
"end": [
108,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.neg_coeffs",
"code": "@[simp] theorem neg_coeffs {l : LinearCombo} : (-l).coeffs = -l.coeffs",
"start": [
109,
1
],
"end": [
109,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.sub_eq_add_neg",
"code": "theorem sub_eq_add_neg (l₁ l₂ : LinearCombo) : l₁ - l₂ = l₁ + -l₂",
"start": [
111,
1
],
"end": [
115,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.smul",
"code": "def smul (lc : LinearCombo) (i : Int) : LinearCombo where\n const := i * lc.const\n coeffs := lc.coeffs.smul i",
"start": [
117,
1
],
"end": [
120,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.smul_const",
"code": "@[simp] theorem smul_const {lc : LinearCombo} {i : Int} : (i * lc).const = i * lc.const",
"start": [
124,
1
],
"end": [
124,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.smul_coeffs",
"code": "@[simp] theorem smul_coeffs {lc : LinearCombo} {i : Int} : (i * lc).coeffs = i * lc.coeffs",
"start": [
125,
1
],
"end": [
125,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.add_eval",
"code": "@[simp] theorem add_eval (l₁ l₂ : LinearCombo) (v : Coeffs) :\n (l₁ + l₂).eval v = l₁.eval v + l₂.eval v",
"start": [
127,
1
],
"end": [
132,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.neg_eval",
"code": "@[simp] theorem neg_eval (lc : LinearCombo) (v : Coeffs) : (-lc).eval v = - lc.eval v",
"start": [
134,
1
],
"end": [
136,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.sub_eval",
"code": "@[simp] theorem sub_eval (l₁ l₂ : LinearCombo) (v : Coeffs) :\n (l₁ - l₂).eval v = l₁.eval v - l₂.eval v",
"start": [
138,
1
],
"end": [
140,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.smul_eval",
"code": "@[simp] theorem smul_eval (lc : LinearCombo) (i : Int) (v : Coeffs) :\n (i * lc).eval v = i * lc.eval v",
"start": [
142,
1
],
"end": [
145,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.smul_eval_comm",
"code": "theorem smul_eval_comm (lc : LinearCombo) (i : Int) (v : Coeffs) :\n (i * lc).eval v = lc.eval v * i",
"start": [
147,
1
],
"end": [
149,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.mul",
"code": "def mul (l₁ l₂ : LinearCombo) : LinearCombo :=\n l₂.const * l₁ + l₁.const * l₂ - { const := l₁.const * l₂.const }",
"start": [
151,
1
],
"end": [
157,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.mul_eval_of_const_left",
"code": "theorem mul_eval_of_const_left (l₁ l₂ : LinearCombo) (v : Coeffs) (w : l₁.coeffs.isZero) :\n (mul l₁ l₂).eval v = l₁.eval v * l₂.eval v",
"start": [
159,
1
],
"end": [
163,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.mul_eval_of_const_right",
"code": "theorem mul_eval_of_const_right (l₁ l₂ : LinearCombo) (v : Coeffs) (w : l₂.coeffs.isZero) :\n (mul l₁ l₂).eval v = l₁.eval v * l₂.eval v",
"start": [
165,
1
],
"end": [
169,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LinearCombo.mul_eval",
"code": "theorem mul_eval (l₁ l₂ : LinearCombo) (v : Coeffs) (w : l₁.coeffs.isZero ∨ l₂.coeffs.isZero) :\n (mul l₁ l₂).eval v = l₁.eval v * l₂.eval v",
"start": [
171,
1
],
"end": [
175,
41
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/Int.lean | [
".lake/packages/lean4/src/lean/Init/Data/Int/DivMod.lean",
".lake/packages/lean4/src/lean/Init/Data/Int/Order.lean"
] | [
{
"full_name": "Lean.Omega.Int.ofNat_pow",
"code": "theorem ofNat_pow (a b : Nat) : ((a ^ b : Nat) : Int) = (a : Int) ^ b",
"start": [
23,
1
],
"end": [
26,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.pos_pow_of_pos",
"code": "theorem pos_pow_of_pos (a : Int) (b : Nat) (h : 0 < a) : 0 < a ^ b",
"start": [
28,
1
],
"end": [
30,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_pos",
"code": "theorem ofNat_pos {a : Nat} : 0 < (a : Int) ↔ 0 < a",
"start": [
32,
1
],
"end": [
33,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_pos_of_pos",
"code": "theorem ofNat_pos_of_pos {a : Nat} (h : 0 < a) : 0 < (a : Int)",
"start": [
35,
1
],
"end": [
36,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.natCast_ofNat",
"code": "theorem natCast_ofNat {x : Nat} :\n @Nat.cast Int instNatCastInt (no_index (OfNat.ofNat x)) = OfNat.ofNat x",
"start": [
38,
1
],
"end": [
39,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_lt_of_lt",
"code": "theorem ofNat_lt_of_lt {x y : Nat} (h : x < y) : (x : Int) < (y : Int)",
"start": [
41,
1
],
"end": [
42,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_le_of_le",
"code": "theorem ofNat_le_of_le {x y : Nat} (h : x ≤ y) : (x : Int) ≤ (y : Int)",
"start": [
44,
1
],
"end": [
45,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_shiftLeft_eq",
"code": "theorem ofNat_shiftLeft_eq {x y : Nat} : (x <<< y : Int) = (x : Int) * (2 ^ y : Nat)",
"start": [
47,
1
],
"end": [
48,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_shiftRight_eq_div_pow",
"code": "theorem ofNat_shiftRight_eq_div_pow {x y : Nat} : (x >>> y : Int) = (x : Int) / (2 ^ y : Nat)",
"start": [
50,
1
],
"end": [
51,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.emod_ofNat_nonneg",
"code": "theorem emod_ofNat_nonneg {x : Nat} {y : Int} : 0 ≤ (x : Int) % y",
"start": [
53,
1
],
"end": [
54,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.lt_of_not_ge",
"code": "theorem lt_of_not_ge {x y : Int} (h : ¬ (x ≤ y)) : y < x",
"start": [
57,
1
],
"end": [
57,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.lt_of_not_le",
"code": "theorem lt_of_not_le {x y : Int} (h : ¬ (x ≤ y)) : y < x",
"start": [
58,
1
],
"end": [
58,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.not_le_of_lt",
"code": "theorem not_le_of_lt {x y : Int} (h : y < x) : ¬ (x ≤ y)",
"start": [
59,
1
],
"end": [
59,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.lt_le_asymm",
"code": "theorem lt_le_asymm {x y : Int} (h₁ : y < x) (h₂ : x ≤ y) : False",
"start": [
60,
1
],
"end": [
60,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.le_lt_asymm",
"code": "theorem le_lt_asymm {x y : Int} (h₁ : y ≤ x) (h₂ : x < y) : False",
"start": [
61,
1
],
"end": [
61,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.le_of_not_gt",
"code": "theorem le_of_not_gt {x y : Int} (h : ¬ (y > x)) : y ≤ x",
"start": [
63,
1
],
"end": [
63,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.not_lt_of_ge",
"code": "theorem not_lt_of_ge {x y : Int} (h : y ≥ x) : ¬ (y < x)",
"start": [
64,
1
],
"end": [
64,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.le_of_not_lt",
"code": "theorem le_of_not_lt {x y : Int} (h : ¬ (x < y)) : y ≤ x",
"start": [
65,
1
],
"end": [
65,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.not_lt_of_le",
"code": "theorem not_lt_of_le {x y : Int} (h : y ≤ x) : ¬ (x < y)",
"start": [
66,
1
],
"end": [
66,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_congr",
"code": "theorem add_congr {a b c d : Int} (h₁ : a = b) (h₂ : c = d) : a + c = b + d",
"start": [
68,
1
],
"end": [
69,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.mul_congr",
"code": "theorem mul_congr {a b c d : Int} (h₁ : a = b) (h₂ : c = d) : a * c = b * d",
"start": [
71,
1
],
"end": [
72,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.mul_congr_left",
"code": "theorem mul_congr_left {a b : Int} (h₁ : a = b) (c : Int) : a * c = b * c",
"start": [
74,
1
],
"end": [
75,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.sub_congr",
"code": "theorem sub_congr {a b c d : Int} (h₁ : a = b) (h₂ : c = d) : a - c = b - d",
"start": [
77,
1
],
"end": [
78,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.neg_congr",
"code": "theorem neg_congr {a b : Int} (h₁ : a = b) : -a = -b",
"start": [
80,
1
],
"end": [
81,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.lt_of_gt",
"code": "theorem lt_of_gt {x y : Int} (h : x > y) : y < x",
"start": [
83,
1
],
"end": [
83,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.le_of_ge",
"code": "theorem le_of_ge {x y : Int} (h : x ≥ y) : y ≤ x",
"start": [
84,
1
],
"end": [
84,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_sub_eq_zero",
"code": "theorem ofNat_sub_eq_zero {b a : Nat} (h : ¬ b ≤ a) : ((a - b : Nat) : Int) = 0",
"start": [
86,
1
],
"end": [
87,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_sub_dichotomy",
"code": "theorem ofNat_sub_dichotomy {a b : Nat} :\n b ≤ a ∧ ((a - b : Nat) : Int) = a - b ∨ a < b ∧ ((a - b : Nat) : Int) = 0",
"start": [
89,
1
],
"end": [
99,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_congr",
"code": "theorem ofNat_congr {a b : Nat} (h : a = b) : (a : Int) = (b : Int)",
"start": [
101,
1
],
"end": [
101,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_sub_sub",
"code": "theorem ofNat_sub_sub {a b c : Nat} : ((a - b - c : Nat) : Int) = ((a - (b + c) : Nat) : Int)",
"start": [
103,
1
],
"end": [
104,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_min",
"code": "theorem ofNat_min (a b : Nat) : ((min a b : Nat) : Int) = min (a : Int) (b : Int)",
"start": [
106,
1
],
"end": [
108,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_max",
"code": "theorem ofNat_max (a b : Nat) : ((max a b : Nat) : Int) = max (a : Int) (b : Int)",
"start": [
110,
1
],
"end": [
112,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_natAbs",
"code": "theorem ofNat_natAbs (a : Int) : (a.natAbs : Int) = if 0 ≤ a then a else -a",
"start": [
114,
1
],
"end": [
119,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.natAbs_dichotomy",
"code": "theorem natAbs_dichotomy {a : Int} : 0 ≤ a ∧ a.natAbs = a ∨ a < 0 ∧ a.natAbs = -a",
"start": [
121,
1
],
"end": [
128,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.neg_le_natAbs",
"code": "theorem neg_le_natAbs {a : Int} : -a ≤ a.natAbs",
"start": [
130,
1
],
"end": [
133,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_le_iff_le_sub",
"code": "theorem add_le_iff_le_sub (a b c : Int) : a + b ≤ c ↔ a ≤ c - b",
"start": [
135,
1
],
"end": [
140,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.le_add_iff_sub_le",
"code": "theorem le_add_iff_sub_le (a b c : Int) : a ≤ b + c ↔ a - c ≤ b",
"start": [
142,
1
],
"end": [
146,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_le_zero_iff_le_neg",
"code": "theorem add_le_zero_iff_le_neg (a b : Int) : a + b ≤ 0 ↔ a ≤ - b",
"start": [
148,
1
],
"end": [
149,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_le_zero_iff_le_neg'",
"code": "theorem add_le_zero_iff_le_neg' (a b : Int) : a + b ≤ 0 ↔ b ≤ -a",
"start": [
150,
1
],
"end": [
151,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_nonnneg_iff_neg_le",
"code": "theorem add_nonnneg_iff_neg_le (a b : Int) : 0 ≤ a + b ↔ -b ≤ a",
"start": [
152,
1
],
"end": [
153,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.add_nonnneg_iff_neg_le'",
"code": "theorem add_nonnneg_iff_neg_le' (a b : Int) : 0 ≤ a + b ↔ -a ≤ b",
"start": [
154,
1
],
"end": [
155,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_fst_mk",
"code": "theorem ofNat_fst_mk {β} {x : Nat} {y : β} : (Prod.mk x y).fst = (x : Int)",
"start": [
157,
1
],
"end": [
157,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Int.ofNat_snd_mk",
"code": "theorem ofNat_snd_mk {α} {x : α} {y : Nat} : (Prod.mk x y).snd = (y : Int)",
"start": [
158,
1
],
"end": [
158,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Nat.lt_of_gt",
"code": "theorem lt_of_gt {x y : Nat} (h : x > y) : y < x",
"start": [
165,
1
],
"end": [
165,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Nat.le_of_ge",
"code": "theorem le_of_ge {x y : Nat} (h : x ≥ y) : y ≤ x",
"start": [
166,
1
],
"end": [
166,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.ne_iff_lt_or_gt",
"code": "theorem ne_iff_lt_or_gt {i j : Fin n} : i ≠ j ↔ i < j ∨ i > j",
"start": [
172,
1
],
"end": [
173,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.lt_or_gt_of_ne",
"code": "protected theorem lt_or_gt_of_ne {i j : Fin n} (h : i ≠ j) : i < j ∨ i > j",
"start": [
175,
1
],
"end": [
175,
103
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.not_le",
"code": "theorem not_le {i j : Fin n} : ¬ i ≤ j ↔ j < i",
"start": [
177,
1
],
"end": [
178,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.not_lt",
"code": "theorem not_lt {i j : Fin n} : ¬ i < j ↔ j ≤ i",
"start": [
180,
1
],
"end": [
181,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.lt_of_not_le",
"code": "protected theorem lt_of_not_le {i j : Fin n} (h : ¬ i ≤ j) : j < i",
"start": [
183,
1
],
"end": [
183,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.le_of_not_lt",
"code": "protected theorem le_of_not_lt {i j : Fin n} (h : ¬ i < j) : j ≤ i",
"start": [
184,
1
],
"end": [
184,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.ofNat_val_add",
"code": "theorem ofNat_val_add {x y : Fin n} :\n (((x + y : Fin n)) : Int) = ((x : Int) + (y : Int)) % n",
"start": [
186,
1
],
"end": [
187,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.ofNat_val_sub",
"code": "theorem ofNat_val_sub {x y : Fin n} :\n (((x - y : Fin n)) : Int) = (((n - y : Nat) + (x : Int) : Int)) % n",
"start": [
189,
1
],
"end": [
190,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.ofNat_val_mul",
"code": "theorem ofNat_val_mul {x y : Fin n} :\n (((x * y : Fin n)) : Int) = ((x : Int) * (y : Int)) % n",
"start": [
192,
1
],
"end": [
193,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Fin.ofNat_val_natCast",
"code": "theorem ofNat_val_natCast {n x y : Nat} (h : y = x % (n + 1)):\n @Nat.cast Int instNatCastInt (@Fin.val (n + 1) (OfNat.ofNat x)) = OfNat.ofNat y",
"start": [
195,
1
],
"end": [
198,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Prod.of_lex",
"code": "theorem of_lex (w : Prod.Lex r s p q) : r p.fst q.fst ∨ p.fst = q.fst ∧ s p.snd q.snd",
"start": [
204,
1
],
"end": [
205,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Prod.of_not_lex",
"code": "theorem of_not_lex {α} {r : α → α → Prop} [DecidableEq α] {β} {s : β → β → Prop}\n {p q : α × β} (w : ¬ Prod.Lex r s p q) :\n ¬ r p.fst q.fst ∧ (p.fst ≠ q.fst ∨ ¬ s p.snd q.snd)",
"start": [
207,
1
],
"end": [
211,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Prod.fst_mk",
"code": "theorem fst_mk : (Prod.mk x y).fst = x",
"start": [
213,
1
],
"end": [
213,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Prod.snd_mk",
"code": "theorem snd_mk : (Prod.mk x y).snd = y",
"start": [
214,
1
],
"end": [
214,
46
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/Logic.lean | [
".lake/packages/lean4/src/lean/Init/PropLemmas.lean"
] | [
{
"full_name": "Lean.Omega.and_not_not_of_not_or",
"code": "theorem and_not_not_of_not_or (h : ¬ (p ∨ q)) : ¬ p ∧ ¬ q",
"start": [
19,
1
],
"end": [
19,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Decidable.or_not_not_of_not_and",
"code": "theorem Decidable.or_not_not_of_not_and [Decidable p] [Decidable q]\n (h : ¬ (p ∧ q)) : ¬ p ∨ ¬ q",
"start": [
21,
1
],
"end": [
23,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Decidable.and_or_not_and_not_of_iff",
"code": "theorem Decidable.and_or_not_and_not_of_iff {p q : Prop} [Decidable q] (h : p ↔ q) :\n (p ∧ q) ∨ (¬p ∧ ¬q)",
"start": [
25,
1
],
"end": [
26,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Decidable.not_iff_iff_and_not_or_not_and",
"code": "theorem Decidable.not_iff_iff_and_not_or_not_and [Decidable a] [Decidable b] :\n (¬ (a ↔ b)) ↔ (a ∧ ¬ b) ∨ ((¬ a) ∧ b)",
"start": [
28,
1
],
"end": [
34,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Decidable.and_not_or_not_and_of_not_iff",
"code": "theorem Decidable.and_not_or_not_and_of_not_iff [Decidable a] [Decidable b]\n (h : ¬ (a ↔ b)) : a ∧ ¬b ∨ ¬a ∧ b",
"start": [
36,
1
],
"end": [
38,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Decidable.and_not_of_not_imp",
"code": "theorem Decidable.and_not_of_not_imp [Decidable a] (h : ¬(a → b)) : a ∧ ¬b",
"start": [
40,
1
],
"end": [
41,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.ite_disjunction",
"code": "theorem ite_disjunction {α : Type u} {P : Prop} [Decidable P] {a b : α} :\n (P ∧ (if P then a else b) = a) ∨ (¬ P ∧ (if P then a else b) = b)",
"start": [
43,
1
],
"end": [
48,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega/Constraint.lean | [
".lake/packages/lean4/src/lean/Init/Omega/Int.lean",
".lake/packages/lean4/src/lean/Init/Omega/LinearCombo.lean"
] | [
{
"full_name": "Lean.Omega.LowerBound",
"code": "abbrev LowerBound : Type := Option Int",
"start": [
17,
1
],
"end": [
18,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.UpperBound",
"code": "abbrev UpperBound : Type := Option Int",
"start": [
19,
1
],
"end": [
20,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.LowerBound.sat",
"code": "abbrev LowerBound.sat (b : LowerBound) (t : Int) := b.all fun x => x ≤ t",
"start": [
22,
1
],
"end": [
23,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.UpperBound.sat",
"code": "abbrev UpperBound.sat (b : UpperBound) (t : Int) := b.all fun y => t ≤ y",
"start": [
24,
1
],
"end": [
25,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint",
"code": "structure Constraint where\n \n lowerBound : LowerBound\n \n upperBound : UpperBound\nderiving BEq, DecidableEq, Repr",
"start": [
27,
1
],
"end": [
36,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.sat",
"code": "def sat (c : Constraint) (t : Int) : Bool := c.lowerBound.sat t ∧ c.upperBound.sat t",
"start": [
48,
1
],
"end": [
49,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.map",
"code": "def map (c : Constraint) (f : Int → Int) : Constraint where\n lowerBound := c.lowerBound.map f\n upperBound := c.upperBound.map f",
"start": [
51,
1
],
"end": [
54,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.translate",
"code": "def translate (c : Constraint) (t : Int) : Constraint := c.map (· + t)",
"start": [
56,
1
],
"end": [
57,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.translate_sat",
"code": "theorem translate_sat : {c : Constraint} → {v : Int} → sat c v → sat (c.translate t) (v + t)",
"start": [
59,
1
],
"end": [
65,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.flip",
"code": "def flip (c : Constraint) : Constraint where\n lowerBound := c.upperBound\n upperBound := c.lowerBound",
"start": [
67,
1
],
"end": [
73,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.neg",
"code": "def neg (c : Constraint) : Constraint := c.flip.map (- ·)",
"start": [
75,
1
],
"end": [
78,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.neg_sat",
"code": "theorem neg_sat : {c : Constraint} → {v : Int} → sat c v → sat (c.neg) (-v)",
"start": [
80,
1
],
"end": [
86,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.trivial",
"code": "def trivial : Constraint := ⟨none, none⟩",
"start": [
88,
1
],
"end": [
89,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.impossible",
"code": "def impossible : Constraint := ⟨some 1, some 0⟩",
"start": [
90,
1
],
"end": [
91,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.exact",
"code": "def exact (r : Int) : Constraint := ⟨some r, some r⟩",
"start": [
92,
1
],
"end": [
93,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.trivial_say",
"code": "@[simp] theorem trivial_say : trivial.sat t",
"start": [
95,
1
],
"end": [
96,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.exact_sat",
"code": "@[simp] theorem exact_sat (r : Int) (t : Int) : (exact r).sat t = decide (r = t)",
"start": [
98,
1
],
"end": [
100,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.isImpossible",
"code": "def isImpossible : Constraint → Bool\n | ⟨some x, some y⟩ => y < x\n | _ => false",
"start": [
102,
1
],
"end": [
105,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.isExact",
"code": "def isExact : Constraint → Bool\n | ⟨some x, some y⟩ => x = y\n | _ => false",
"start": [
107,
1
],
"end": [
110,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.not_sat_of_isImpossible",
"code": "theorem not_sat_of_isImpossible (h : isImpossible c) {t} : ¬ c.sat t",
"start": [
112,
1
],
"end": [
116,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.scale",
"code": "def scale (k : Int) (c : Constraint) : Constraint :=\n if k = 0 then\n if c.isImpossible then c else ⟨some 0, some 0⟩\n else if 0 < k then\n c.map (k * ·)\n else\n c.flip.map (k * ·)",
"start": [
118,
1
],
"end": [
131,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.scale_sat",
"code": "theorem scale_sat {c : Constraint} (k) (w : c.sat t) : (scale k c).sat (k * t)",
"start": [
133,
1
],
"end": [
154,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.add",
"code": "def add (x y : Constraint) : Constraint where\n lowerBound := x.lowerBound.bind fun a => y.lowerBound.map fun b => a + b\n upperBound := x.upperBound.bind fun a => y.upperBound.map fun b => a + b",
"start": [
156,
1
],
"end": [
159,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.add_sat",
"code": "theorem add_sat (w₁ : c₁.sat x₁) (w₂ : c₂.sat x₂) : (add c₁ c₂).sat (x₁ + x₂)",
"start": [
161,
1
],
"end": [
172,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.combo",
"code": "def combo (a : Int) (x : Constraint) (b : Int) (y : Constraint) : Constraint :=\n add (scale a x) (scale b y)",
"start": [
174,
1
],
"end": [
176,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.combo_sat",
"code": "theorem combo_sat (a) (w₁ : c₁.sat x₁) (b) (w₂ : c₂.sat x₂) :\n (combo a c₁ b c₂).sat (a * x₁ + b * x₂)",
"start": [
178,
1
],
"end": [
180,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.combine",
"code": "def combine (x y : Constraint) : Constraint where\n lowerBound := max x.lowerBound y.lowerBound\n upperBound := min x.upperBound y.upperBound",
"start": [
182,
1
],
"end": [
185,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.combine_sat",
"code": "theorem combine_sat : (c : Constraint) → (c' : Constraint) → (t : Int) →\n (c.combine c').sat t = (c.sat t ∧ c'.sat t)",
"start": [
187,
1
],
"end": [
196,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.div",
"code": "def div (c : Constraint) (k : Nat) : Constraint where\n lowerBound := c.lowerBound.map fun x => (- ((- x) / k))\n upperBound := c.upperBound.map fun y => y / k",
"start": [
198,
1
],
"end": [
204,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.div_sat",
"code": "theorem div_sat (c : Constraint) (t : Int) (k : Nat) (n : k ≠ 0) (h : (k : Int) ∣ t) (w : c.sat t) :\n (c.div k).sat (t / k)",
"start": [
206,
1
],
"end": [
228,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.sat'",
"code": "abbrev sat' (c : Constraint) (x y : Coeffs) := c.sat (Coeffs.dot x y)",
"start": [
230,
1
],
"end": [
234,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.combine_sat'",
"code": "theorem combine_sat' {s t : Constraint} {x y} (ws : s.sat' x y) (wt : t.sat' x y) :\n (s.combine t).sat' x y",
"start": [
236,
1
],
"end": [
237,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.div_sat'",
"code": "theorem div_sat' {c : Constraint} {x y} (h : Coeffs.gcd x ≠ 0) (w : c.sat (Coeffs.dot x y)) :\n (c.div (Coeffs.gcd x)).sat' (Coeffs.sdiv x (Coeffs.gcd x)) y",
"start": [
239,
1
],
"end": [
243,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.not_sat'_of_isImpossible",
"code": "theorem not_sat'_of_isImpossible (h : isImpossible c) {x y} : ¬ c.sat' x y",
"start": [
245,
1
],
"end": [
246,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.addInequality_sat",
"code": "theorem addInequality_sat (w : c + Coeffs.dot x y ≥ 0) :\n Constraint.sat' { lowerBound := some (-c), upperBound := none } x y",
"start": [
248,
1
],
"end": [
252,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.Constraint.addEquality_sat",
"code": "theorem addEquality_sat (w : c + Coeffs.dot x y = 0) :\n Constraint.sat' { lowerBound := some (-c), upperBound := some (-c) } x y",
"start": [
254,
1
],
"end": [
258,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalize?",
"code": "def normalize? : Constraint × Coeffs → Option (Constraint × Coeffs)\n | ⟨s, x⟩ =>\n let gcd := Coeffs.gcd x if gcd = 0 then\n if s.sat 0 then\n some (.trivial, x)\n else\n some (.impossible, x)\n else if gcd = 1 then\n none\n else\n some (s.div gcd, Coeffs.sdiv x gcd)",
"start": [
262,
1
],
"end": [
278,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalize",
"code": "def normalize (p : Constraint × Coeffs) : Constraint × Coeffs :=\n normalize? p |>.getD p",
"start": [
280,
1
],
"end": [
282,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalizeConstraint",
"code": "noncomputable abbrev normalizeConstraint (s : Constraint) (x : Coeffs) : Constraint :=\n (normalize (s, x)).1",
"start": [
284,
1
],
"end": [
287,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalizeCoeffs",
"code": "noncomputable abbrev normalizeCoeffs (s : Constraint) (x : Coeffs) : Coeffs :=\n (normalize (s, x)).2",
"start": [
288,
1
],
"end": [
290,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalize?_eq_some",
"code": "theorem normalize?_eq_some (w : normalize? (s, x) = some (s', x')) :\n normalizeConstraint s x = s' ∧ normalizeCoeffs s x = x'",
"start": [
292,
1
],
"end": [
294,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.normalize_sat",
"code": "theorem normalize_sat {s x v} (w : s.sat' x v) :\n (normalizeConstraint s x).sat' (normalizeCoeffs s x) v",
"start": [
296,
1
],
"end": [
306,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivize?",
"code": "def positivize? : Constraint × Coeffs → Option (Constraint × Coeffs)\n | ⟨s, x⟩ =>\n if 0 ≤ x.leading then\n none\n else\n (s.neg, Coeffs.smul x (-1))",
"start": [
308,
1
],
"end": [
314,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivize",
"code": "noncomputable def positivize (p : Constraint × Coeffs) : Constraint × Coeffs :=\n positivize? p |>.getD p",
"start": [
316,
1
],
"end": [
318,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivizeConstraint",
"code": "noncomputable abbrev positivizeConstraint (s : Constraint) (x : Coeffs) : Constraint :=\n (positivize (s, x)).1",
"start": [
320,
1
],
"end": [
322,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivizeCoeffs",
"code": "noncomputable abbrev positivizeCoeffs (s : Constraint) (x : Coeffs) : Coeffs :=\n (positivize (s, x)).2",
"start": [
323,
1
],
"end": [
325,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivize?_eq_some",
"code": "theorem positivize?_eq_some (w : positivize? (s, x) = some (s', x')) :\n positivizeConstraint s x = s' ∧ positivizeCoeffs s x = x'",
"start": [
327,
1
],
"end": [
329,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.positivize_sat",
"code": "theorem positivize_sat {s x v} (w : s.sat' x v) :\n (positivizeConstraint s x).sat' (positivizeCoeffs s x) v",
"start": [
331,
1
],
"end": [
338,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.tidy?",
"code": "def tidy? : Constraint × Coeffs → Option (Constraint × Coeffs)\n | ⟨s, x⟩ =>\n match positivize? (s, x) with\n | none => match normalize? (s, x) with\n | none => none\n | some (s', x') => some (s', x')\n | some (s', x') => normalize (s', x')",
"start": [
340,
1
],
"end": [
347,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.tidy",
"code": "def tidy (p : Constraint × Coeffs) : Constraint × Coeffs :=\n tidy? p |>.getD p",
"start": [
349,
1
],
"end": [
351,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.tidyConstraint",
"code": "abbrev tidyConstraint (s : Constraint) (x : Coeffs) : Constraint := (tidy (s, x)).1",
"start": [
353,
1
],
"end": [
354,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.tidyCoeffs",
"code": "abbrev tidyCoeffs (s : Constraint) (x : Coeffs) : Coeffs := (tidy (s, x)).2",
"start": [
355,
1
],
"end": [
356,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.tidy_sat",
"code": "theorem tidy_sat {s x v} (w : s.sat' x v) : (tidyConstraint s x).sat' (tidyCoeffs s x) v",
"start": [
358,
1
],
"end": [
366,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.combo_sat'",
"code": "theorem combo_sat' (s t : Constraint)\n (a : Int) (x : Coeffs) (b : Int) (y : Coeffs) (v : Coeffs)\n (wx : s.sat' x v) (wy : t.sat' y v) :\n (Constraint.combo a s b t).sat' (Coeffs.combo a x b y) v",
"start": [
368,
1
],
"end": [
374,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.bmod_div_term",
"code": "abbrev bmod_div_term (m : Nat) (a b : Coeffs) : Int := Coeffs.bmod_dot_sub_dot_bmod m a b / m",
"start": [
376,
1
],
"end": [
377,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.bmod_coeffs",
"code": "def bmod_coeffs (m : Nat) (i : Nat) (x : Coeffs) : Coeffs :=\n Coeffs.set (Coeffs.bmod x m) i m",
"start": [
379,
1
],
"end": [
381,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Omega.bmod_sat",
"code": "theorem bmod_sat (m : Nat) (r : Int) (i : Nat) (x v : Coeffs)\n (h : x.length ≤ i) (p : Coeffs.get v i = bmod_div_term m x v) (w : (Constraint.exact r).sat' x v) :\n (Constraint.exact (Int.bmod r m)).sat' (bmod_coeffs m i x) v",
"start": [
383,
1
],
"end": [
393,
86
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/MinMax.lean | [
".lake/packages/lean4/src/lean/Init/ByCases.lean"
] | [
{
"full_name": "Nat.min_eq_min",
"code": "protected theorem min_eq_min (a : Nat) : Nat.min a b = min a b",
"start": [
13,
1
],
"end": [
13,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_comm",
"code": "protected theorem min_comm (a b : Nat) : min a b = min b a",
"start": [
15,
1
],
"end": [
19,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_le_right",
"code": "protected theorem min_le_right (a b : Nat) : min a b ≤ b",
"start": [
22,
1
],
"end": [
23,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_le_left",
"code": "protected theorem min_le_left (a b : Nat) : min a b ≤ a",
"start": [
24,
1
],
"end": [
25,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_eq_left",
"code": "protected theorem min_eq_left {a b : Nat} (h : a ≤ b) : min a b = a",
"start": [
27,
1
],
"end": [
27,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_eq_right",
"code": "protected theorem min_eq_right {a b : Nat} (h : b ≤ a) : min a b = b",
"start": [
28,
1
],
"end": [
29,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_min_of_le_of_le",
"code": "protected theorem le_min_of_le_of_le {a b c : Nat} : a ≤ b → a ≤ c → a ≤ min b c",
"start": [
31,
1
],
"end": [
34,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_min",
"code": "protected theorem le_min {a b c : Nat} : a ≤ min b c ↔ a ≤ b ∧ a ≤ c",
"start": [
36,
1
],
"end": [
38,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_min",
"code": "protected theorem lt_min {a b c : Nat} : a < min b c ↔ a < b ∧ a < c",
"start": [
40,
1
],
"end": [
40,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_eq_max",
"code": "protected theorem max_eq_max (a : Nat) : Nat.max a b = max a b",
"start": [
44,
1
],
"end": [
44,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_comm",
"code": "protected theorem max_comm (a b : Nat) : max a b = max b a",
"start": [
46,
1
],
"end": [
50,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_max_left",
"code": "protected theorem le_max_left ( a b : Nat) : a ≤ max a b",
"start": [
53,
1
],
"end": [
54,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_max_right",
"code": "protected theorem le_max_right (a b : Nat) : b ≤ max a b",
"start": [
55,
1
],
"end": [
56,
40
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Power2.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean"
] | [
{
"full_name": "Nat.two_pow_pos",
"code": "protected theorem two_pow_pos (w : Nat) : 0 < 2^w",
"start": [
11,
1
],
"end": [
11,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.nextPowerOfTwo_dec",
"code": "theorem nextPowerOfTwo_dec {n power : Nat} (h₁ : power > 0) (h₂ : power < n) : n - power * 2 < n - power",
"start": [
13,
1
],
"end": [
16,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.nextPowerOfTwo",
"code": "def nextPowerOfTwo (n : Nat) : Nat :=\n go 1 (by decide)\nwhere\n go (power : Nat) (h : power > 0) : Nat :=\n if power < n then\n go (power * 2) (Nat.mul_pos h (by decide))\n else\n power\n termination_by n - power\n decreasing_by simp_wf; apply nextPowerOfTwo_dec <;> assumption",
"start": [
18,
1
],
"end": [
27,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.isPowerOfTwo",
"code": "def isPowerOfTwo (n : Nat) := ∃ k, n = 2 ^ k",
"start": [
29,
1
],
"end": [
29,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_isPowerOfTwo",
"code": "theorem one_isPowerOfTwo : isPowerOfTwo 1",
"start": [
31,
1
],
"end": [
32,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul2_isPowerOfTwo_of_isPowerOfTwo",
"code": "theorem mul2_isPowerOfTwo_of_isPowerOfTwo (h : isPowerOfTwo n) : isPowerOfTwo (n * 2)",
"start": [
34,
1
],
"end": [
36,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_isPowerOfTwo",
"code": "theorem pos_of_isPowerOfTwo (h : isPowerOfTwo n) : n > 0",
"start": [
38,
1
],
"end": [
42,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.isPowerOfTwo_nextPowerOfTwo",
"code": "theorem isPowerOfTwo_nextPowerOfTwo (n : Nat) : n.nextPowerOfTwo.isPowerOfTwo",
"start": [
44,
1
],
"end": [
54,
65
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Omega.lean | [
".lake/packages/lean4/src/lean/Init/Omega/Constraint.lean",
".lake/packages/lean4/src/lean/Init/Omega/IntList.lean",
".lake/packages/lean4/src/lean/Init/Omega/Logic.lean",
".lake/packages/lean4/src/lean/Init/Omega/Int.lean",
".lake/packages/lean4/src/lean/Init/Omega/LinearCombo.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Log2.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean"
] | [
{
"full_name": "Nat.log2_terminates",
"code": "theorem log2_terminates : ∀ n, n ≥ 2 → n / 2 < n",
"start": [
11,
1
],
"end": [
18,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.log2",
"code": "@[extern \"lean_nat_log2\"]\ndef log2 (n : @& Nat) : Nat :=\n if n ≥ 2 then log2 (n / 2) + 1 else 0\ndecreasing_by exact log2_terminates _ ‹_›",
"start": [
20,
1
],
"end": [
28,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.log2_le_self",
"code": "theorem log2_le_self (n : Nat) : Nat.log2 n ≤ n",
"start": [
30,
1
],
"end": [
36,
46
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Nat/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Log2.lean",
".lake/packages/lean4/src/lean/Init/Omega.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Power2.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/MinMax.lean"
] | [
{
"full_name": "Nat.add_add_add_comm",
"code": "protected theorem add_add_add_comm (a b c d : Nat) : (a + b) + (c + d) = (a + c) + (b + d)",
"start": [
24,
1
],
"end": [
25,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_add",
"code": "theorem one_add (n) : 1 + n = succ n",
"start": [
27,
1
],
"end": [
27,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_eq_one_add",
"code": "theorem succ_eq_one_add (n) : succ n = 1 + n",
"start": [
29,
1
],
"end": [
29,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_add_eq_add_succ",
"code": "theorem succ_add_eq_add_succ (a b) : succ a + b = a + succ b",
"start": [
31,
1
],
"end": [
31,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_zero_of_add_eq_zero_right",
"code": "protected theorem eq_zero_of_add_eq_zero_right (h : n + m = 0) : n = 0",
"start": [
33,
1
],
"end": [
34,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_eq_zero_iff",
"code": "protected theorem add_eq_zero_iff : n + m = 0 ↔ n = 0 ∧ m = 0",
"start": [
36,
1
],
"end": [
37,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_left_cancel_iff",
"code": "protected theorem add_left_cancel_iff {n : Nat} : n + m = n + k ↔ m = k",
"start": [
39,
1
],
"end": [
40,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_right_cancel_iff",
"code": "protected theorem add_right_cancel_iff {n : Nat} : m + n = k + n ↔ m = k",
"start": [
42,
1
],
"end": [
43,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_add_iff_left",
"code": "protected theorem add_le_add_iff_left {n : Nat} : n + m ≤ n + k ↔ m ≤ k",
"start": [
45,
1
],
"end": [
46,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_add_lt_add_right",
"code": "protected theorem lt_of_add_lt_add_right : ∀ {n : Nat}, k + n < m + n → k < m",
"start": [
48,
1
],
"end": [
50,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_of_add_lt_add_left",
"code": "protected theorem lt_of_add_lt_add_left {n : Nat} : n + k < n + m → k < m",
"start": [
52,
1
],
"end": [
53,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_iff_left",
"code": "protected theorem add_lt_add_iff_left {k n m : Nat} : k + n < k + m ↔ n < m",
"start": [
55,
1
],
"end": [
56,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_iff_right",
"code": "protected theorem add_lt_add_iff_right {k n m : Nat} : n + k < m + k ↔ n < m",
"start": [
58,
1
],
"end": [
59,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_of_le_of_lt",
"code": "protected theorem add_lt_add_of_le_of_lt {a b c d : Nat} (hle : a ≤ b) (hlt : c < d) :\n a + c < b + d",
"start": [
61,
1
],
"end": [
63,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_add_of_lt_of_le",
"code": "protected theorem add_lt_add_of_lt_of_le {a b c d : Nat} (hlt : a < b) (hle : c ≤ d) :\n a + c < b + d",
"start": [
65,
1
],
"end": [
67,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_of_pos_left",
"code": "protected theorem lt_add_of_pos_left : 0 < k → n < k + n",
"start": [
69,
1
],
"end": [
70,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_lt_add_right",
"code": "protected theorem pos_of_lt_add_right (h : n < n + k) : 0 < k",
"start": [
72,
1
],
"end": [
73,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_lt_add_left",
"code": "protected theorem pos_of_lt_add_left : n < k + n → 0 < k",
"start": [
75,
1
],
"end": [
76,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_right_iff_pos",
"code": "protected theorem lt_add_right_iff_pos : n < n + k ↔ 0 < k",
"start": [
78,
1
],
"end": [
79,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_add_left_iff_pos",
"code": "protected theorem lt_add_left_iff_pos : n < k + n ↔ 0 < k",
"start": [
81,
1
],
"end": [
82,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_pos_left",
"code": "protected theorem add_pos_left (h : 0 < m) (n) : 0 < m + n",
"start": [
84,
1
],
"end": [
85,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_pos_right",
"code": "protected theorem add_pos_right (m) (h : 0 < n) : 0 < m + n",
"start": [
87,
1
],
"end": [
88,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_self_ne_one",
"code": "protected theorem add_self_ne_one : ∀ n, n + n ≠ 1",
"start": [
90,
1
],
"end": [
91,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one",
"code": "protected theorem sub_one (n) : n - 1 = pred n",
"start": [
95,
1
],
"end": [
95,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_sub",
"code": "protected theorem one_sub : ∀ n, 1 - n = if n = 0 then 1 else 0",
"start": [
97,
1
],
"end": [
99,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_sub_sub_succ",
"code": "theorem succ_sub_sub_succ (n m k) : succ n - m - succ k = n - m - k",
"start": [
101,
1
],
"end": [
102,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_sub_add_right",
"code": "theorem add_sub_sub_add_right (n m k l : Nat) :\n (n + l) - m - (k + l) = n - m - k",
"start": [
104,
1
],
"end": [
106,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_right_comm",
"code": "protected theorem sub_right_comm (m n k : Nat) : m - n - k = m - k - n",
"start": [
108,
1
],
"end": [
109,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_cancel_right",
"code": "protected theorem add_sub_cancel_right (n m : Nat) : (n + m) - m = n",
"start": [
111,
1
],
"end": [
111,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_sub_cancel'",
"code": "@[simp] protected theorem add_sub_cancel' {n m : Nat} (h : m ≤ n) : m + (n - m) = n",
"start": [
113,
1
],
"end": [
114,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_sub_one",
"code": "theorem succ_sub_one (n) : succ n - 1 = n",
"start": [
116,
1
],
"end": [
116,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_sub_one",
"code": "protected theorem add_one_sub_one (n : Nat) : (n + 1) - 1 = n",
"start": [
118,
1
],
"end": [
118,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_add_sub_one",
"code": "protected theorem one_add_sub_one (n : Nat) : (1 + n) - 1 = n",
"start": [
120,
1
],
"end": [
120,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_sub_self",
"code": "protected theorem sub_sub_self {n m : Nat} (h : m ≤ n) : n - (n - m) = m",
"start": [
122,
1
],
"end": [
123,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_comm",
"code": "protected theorem sub_add_comm {n m k : Nat} (h : k ≤ n) : n + m - k = n - k + m",
"start": [
125,
1
],
"end": [
127,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_zero_iff_le",
"code": "protected theorem sub_eq_zero_iff_le : n - m = 0 ↔ n ≤ m",
"start": [
129,
1
],
"end": [
130,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_pos_iff_lt",
"code": "protected theorem sub_pos_iff_lt : 0 < n - m ↔ m < n",
"start": [
132,
1
],
"end": [
133,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_iff_le_add",
"code": "protected theorem sub_le_iff_le_add {a b c : Nat} : a - b ≤ c ↔ a ≤ c + b",
"start": [
135,
1
],
"end": [
136,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_iff_le_add'",
"code": "protected theorem sub_le_iff_le_add' {a b c : Nat} : a - b ≤ c ↔ a ≤ b + c",
"start": [
138,
1
],
"end": [
139,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_iff_add_le",
"code": "protected theorem le_sub_iff_add_le {n : Nat} (h : k ≤ m) : n ≤ m - k ↔ n + k ≤ m",
"start": [
141,
1
],
"end": [
142,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_to_le_sub",
"code": "@[deprecated Nat.le_sub_iff_add_le (since := \"2024-02-19\")]\nprotected theorem add_le_to_le_sub (n : Nat) (h : m ≤ k) : n + m ≤ k ↔ n ≤ k - m",
"start": [
144,
1
],
"end": [
146,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_of_le_sub'",
"code": "protected theorem add_le_of_le_sub' {n k m : Nat} (h : m ≤ k) : n ≤ k - m → m + n ≤ k",
"start": [
148,
1
],
"end": [
149,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_le_of_le_sub_left",
"code": "@[deprecated Nat.add_le_of_le_sub' (since := \"2024-02-19\")]\nprotected theorem add_le_of_le_sub_left {n k m : Nat} (h : m ≤ k) : n ≤ k - m → m + n ≤ k",
"start": [
151,
1
],
"end": [
153,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_of_add_le'",
"code": "protected theorem le_sub_of_add_le' {n k m : Nat} : m + n ≤ k → n ≤ k - m",
"start": [
155,
1
],
"end": [
156,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_sub_iff_add_le'",
"code": "protected theorem le_sub_iff_add_le' {n : Nat} (h : k ≤ m) : n ≤ m - k ↔ k + n ≤ m",
"start": [
158,
1
],
"end": [
159,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_sub_le_sub_left",
"code": "protected theorem le_of_sub_le_sub_left : ∀ {n k m : Nat}, n ≤ k → k - m ≤ k - n → n ≤ m",
"start": [
161,
1
],
"end": [
167,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_le_sub_iff_left",
"code": "protected theorem sub_le_sub_iff_left {n m k : Nat} (h : n ≤ k) : k - m ≤ k - n ↔ n ≤ m",
"start": [
169,
1
],
"end": [
170,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_of_pos_le",
"code": "protected theorem sub_lt_of_pos_le (h₀ : 0 < a) (h₁ : a ≤ b) : b - a < b",
"start": [
172,
1
],
"end": [
173,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_self",
"code": "protected abbrev sub_lt_self := @Nat.sub_lt_of_pos_le",
"start": [
174,
1
],
"end": [
174,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_lt_of_lt_sub'",
"code": "theorem add_lt_of_lt_sub' {a b c : Nat} : b < c - a → a + b < c",
"start": [
176,
1
],
"end": [
177,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_lt_sub",
"code": "protected theorem sub_add_lt_sub (h₁ : m + k ≤ n) (h₂ : 0 < k) : n - (m + k) < n - m",
"start": [
179,
1
],
"end": [
180,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_lt_of_le",
"code": "theorem sub_one_lt_of_le (h₀ : 0 < a) (h₁ : a ≤ b) : a - 1 < b",
"start": [
182,
1
],
"end": [
183,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_succ",
"code": "theorem sub_lt_succ (a b) : a - b < succ a",
"start": [
185,
1
],
"end": [
185,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_lt_add_one",
"code": "theorem sub_lt_add_one (a b) : a - b < a + 1",
"start": [
187,
1
],
"end": [
187,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_one_sub_lt",
"code": "theorem sub_one_sub_lt (h : i < n) : n - 1 - i < n",
"start": [
189,
1
],
"end": [
190,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.exists_eq_add_of_le",
"code": "protected theorem exists_eq_add_of_le (h : m ≤ n) : ∃ k : Nat, n = m + k",
"start": [
192,
1
],
"end": [
193,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.exists_eq_add_of_le'",
"code": "protected theorem exists_eq_add_of_le' (h : m ≤ n) : ∃ k : Nat, n = k + m",
"start": [
195,
1
],
"end": [
196,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.exists_eq_add_of_lt",
"code": "protected theorem exists_eq_add_of_lt (h : m < n) : ∃ k : Nat, n = m + k + 1",
"start": [
198,
1
],
"end": [
199,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_min_succ",
"code": "theorem succ_min_succ (x y) : min (succ x) (succ y) = succ (min x y)",
"start": [
203,
1
],
"end": [
206,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_self",
"code": "@[simp] protected theorem min_self (a : Nat) : min a a = a",
"start": [
208,
1
],
"end": [
208,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_min",
"code": "@[simp] protected theorem zero_min (a) : min 0 a = 0",
"start": [
211,
1
],
"end": [
211,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_zero",
"code": "@[simp] protected theorem min_zero (a) : min a 0 = 0",
"start": [
213,
1
],
"end": [
213,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_assoc",
"code": "@[simp] protected theorem min_assoc : ∀ (a b c : Nat), min (min a b) c = min a (min b c)",
"start": [
215,
1
],
"end": [
219,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_self_assoc",
"code": "@[simp] protected theorem min_self_assoc {m n : Nat} : min m (min m n) = min m n",
"start": [
222,
1
],
"end": [
223,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_self_assoc'",
"code": "@[simp] protected theorem min_self_assoc' {m n : Nat} : min n (min m n) = min n m",
"start": [
225,
1
],
"end": [
226,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_sub_eq_min",
"code": "protected theorem sub_sub_eq_min : ∀ (a b : Nat), a - (a - b) = min a b",
"start": [
228,
1
],
"end": [
233,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_sub_min",
"code": "protected theorem sub_eq_sub_min (n m : Nat) : n - m = n - min n m",
"start": [
235,
1
],
"end": [
238,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_min_cancel",
"code": "@[simp] protected theorem sub_add_min_cancel (n m : Nat) : n - m + min n m = n",
"start": [
240,
1
],
"end": [
241,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_eq_right",
"code": "protected theorem max_eq_right {a b : Nat} (h : a ≤ b) : max a b = b",
"start": [
243,
1
],
"end": [
243,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_eq_left",
"code": "protected theorem max_eq_left {a b : Nat} (h : b ≤ a) : max a b = a",
"start": [
245,
1
],
"end": [
246,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_max_succ",
"code": "protected theorem succ_max_succ (x y) : max (succ x) (succ y) = succ (max x y)",
"start": [
248,
1
],
"end": [
251,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_le_of_le_of_le",
"code": "protected theorem max_le_of_le_of_le {a b c : Nat} : a ≤ c → b ≤ c → max a b ≤ c",
"start": [
253,
1
],
"end": [
256,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_le",
"code": "protected theorem max_le {a b c : Nat} : max a b ≤ c ↔ a ≤ c ∧ b ≤ c",
"start": [
258,
1
],
"end": [
260,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_lt",
"code": "protected theorem max_lt {a b c : Nat} : max a b < c ↔ a < c ∧ b < c",
"start": [
262,
1
],
"end": [
263,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_self",
"code": "@[simp] protected theorem max_self (a : Nat) : max a a = a",
"start": [
265,
1
],
"end": [
265,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_max",
"code": "@[simp] protected theorem zero_max (a) : max 0 a = a",
"start": [
268,
1
],
"end": [
268,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_zero",
"code": "@[simp] protected theorem max_zero (a) : max a 0 = a",
"start": [
270,
1
],
"end": [
270,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_assoc",
"code": "protected theorem max_assoc : ∀ (a b c : Nat), max (max a b) c = max a (max b c)",
"start": [
275,
1
],
"end": [
279,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_add_eq_max",
"code": "protected theorem sub_add_eq_max (a b : Nat) : a - b + b = max a b",
"start": [
282,
1
],
"end": [
285,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_eq_max_sub",
"code": "protected theorem sub_eq_max_sub (n m : Nat) : n - m = max n m - m",
"start": [
287,
1
],
"end": [
290,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_min_distrib_left",
"code": "protected theorem max_min_distrib_left : ∀ (a b c : Nat), max a (min b c) = min (max a b) (max a c)",
"start": [
292,
1
],
"end": [
302,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_max_distrib_left",
"code": "protected theorem min_max_distrib_left : ∀ (a b c : Nat), min a (max b c) = max (min a b) (min a c)",
"start": [
304,
1
],
"end": [
310,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.max_min_distrib_right",
"code": "protected theorem max_min_distrib_right (a b c : Nat) :\n max (min a b) c = min (max a c) (max b c)",
"start": [
312,
1
],
"end": [
315,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.min_max_distrib_right",
"code": "protected theorem min_max_distrib_right (a b c : Nat) :\n min (max a b) c = max (min a c) (min b c)",
"start": [
317,
1
],
"end": [
320,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_max_add_right",
"code": "protected theorem add_max_add_right : ∀ (a b c : Nat), max (a + c) (b + c) = max a b + c",
"start": [
322,
1
],
"end": [
324,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_min_add_right",
"code": "protected theorem add_min_add_right : ∀ (a b c : Nat), min (a + c) (b + c) = min a b + c",
"start": [
326,
1
],
"end": [
328,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_max_add_left",
"code": "protected theorem add_max_add_left (a b c : Nat) : max (a + b) (a + c) = a + max b c",
"start": [
330,
1
],
"end": [
332,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_min_add_left",
"code": "protected theorem add_min_add_left (a b c : Nat) : min (a + b) (a + c) = a + min b c",
"start": [
334,
1
],
"end": [
336,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_min_pred",
"code": "protected theorem pred_min_pred : ∀ (x y), min (pred x) (pred y) = pred (min x y)",
"start": [
338,
1
],
"end": [
341,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pred_max_pred",
"code": "protected theorem pred_max_pred : ∀ (x y), max (pred x) (pred y) = pred (max x y)",
"start": [
343,
1
],
"end": [
346,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_min_sub_right",
"code": "protected theorem sub_min_sub_right : ∀ (a b c : Nat), min (a - c) (b - c) = min a b - c",
"start": [
348,
1
],
"end": [
350,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_max_sub_right",
"code": "protected theorem sub_max_sub_right : ∀ (a b c : Nat), max (a - c) (b - c) = max a b - c",
"start": [
352,
1
],
"end": [
354,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_min_sub_left",
"code": "protected theorem sub_min_sub_left (a b c : Nat) : min (a - b) (a - c) = a - max b c",
"start": [
356,
1
],
"end": [
357,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_max_sub_left",
"code": "protected theorem sub_max_sub_left (a b c : Nat) : max (a - b) (a - c) = a - min b c",
"start": [
359,
1
],
"end": [
360,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_max_mul_right",
"code": "protected theorem mul_max_mul_right (a b c : Nat) : max (a * c) (b * c) = max a b * c",
"start": [
362,
1
],
"end": [
366,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_min_mul_right",
"code": "protected theorem mul_min_mul_right (a b c : Nat) : min (a * c) (b * c) = min a b * c",
"start": [
368,
1
],
"end": [
372,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_max_mul_left",
"code": "protected theorem mul_max_mul_left (a b c : Nat) : max (a * b) (a * c) = a * max b c",
"start": [
374,
1
],
"end": [
376,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_min_mul_left",
"code": "protected theorem mul_min_mul_left (a b c : Nat) : min (a * b) (a * c) = a * min b c",
"start": [
378,
1
],
"end": [
380,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_mul_of_nonneg_left",
"code": "@[deprecated Nat.mul_le_mul_left (since := \"2024-02-19\")]\nprotected theorem mul_le_mul_of_nonneg_left {a b c : Nat} : a ≤ b → c * a ≤ c * b",
"start": [
416,
1
],
"end": [
418,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_mul_of_nonneg_right",
"code": "@[deprecated Nat.mul_le_mul_right (since := \"2024-02-19\")]\nprotected theorem mul_le_mul_of_nonneg_right {a b c : Nat} : a ≤ b → a * c ≤ b * c",
"start": [
420,
1
],
"end": [
422,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_right_comm",
"code": "protected theorem mul_right_comm (n m k : Nat) : n * m * k = n * k * m",
"start": [
424,
1
],
"end": [
425,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mul_mul_comm",
"code": "protected theorem mul_mul_mul_comm (a b c d : Nat) : (a * b) * (c * d) = (a * c) * (b * d)",
"start": [
427,
1
],
"end": [
428,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_eq_zero",
"code": "theorem mul_eq_zero : ∀ {m n}, n * m = 0 ↔ n = 0 ∨ m = 0",
"start": [
430,
1
],
"end": [
433,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_ne_zero_iff",
"code": "protected theorem mul_ne_zero_iff : n * m ≠ 0 ↔ n ≠ 0 ∧ m ≠ 0",
"start": [
435,
1
],
"end": [
435,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_ne_zero",
"code": "protected theorem mul_ne_zero : n ≠ 0 → m ≠ 0 → n * m ≠ 0",
"start": [
437,
1
],
"end": [
437,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_zero_of_mul_ne_zero_left",
"code": "protected theorem ne_zero_of_mul_ne_zero_left (h : n * m ≠ 0) : n ≠ 0",
"start": [
439,
1
],
"end": [
440,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_left_cancel",
"code": "protected theorem mul_left_cancel {n m k : Nat} (np : 0 < n) (h : n * m = n * k) : m = k",
"start": [
442,
1
],
"end": [
450,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_right_cancel",
"code": "protected theorem mul_right_cancel {n m k : Nat} (mp : 0 < m) (h : n * m = k * m) : n = k",
"start": [
452,
1
],
"end": [
454,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_left_cancel_iff",
"code": "protected theorem mul_left_cancel_iff {n: Nat} (p : 0 < n) (m k : Nat) : n * m = n * k ↔ m = k",
"start": [
456,
1
],
"end": [
457,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_right_cancel_iff",
"code": "protected theorem mul_right_cancel_iff {m : Nat} (p : 0 < m) (n k : Nat) : n * m = k * m ↔ n = k",
"start": [
459,
1
],
"end": [
460,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.ne_zero_of_mul_ne_zero_right",
"code": "protected theorem ne_zero_of_mul_ne_zero_right (h : n * m ≠ 0) : m ≠ 0",
"start": [
462,
1
],
"end": [
463,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_mul_of_pos_left",
"code": "protected theorem le_mul_of_pos_left (m) (h : 0 < n) : m ≤ n * m",
"start": [
465,
1
],
"end": [
466,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_mul_of_pos_right",
"code": "protected theorem le_mul_of_pos_right (n) (h : 0 < m) : n ≤ n * m",
"start": [
468,
1
],
"end": [
469,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_lt_of_le",
"code": "protected theorem mul_lt_mul_of_lt_of_le (hac : a < c) (hbd : b ≤ d) (hd : 0 < d) :\n a * b < c * d",
"start": [
471,
1
],
"end": [
473,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_lt_of_le'",
"code": "protected theorem mul_lt_mul_of_lt_of_le' (hac : a < c) (hbd : b ≤ d) (hb : 0 < b) :\n a * b < c * d",
"start": [
475,
1
],
"end": [
477,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_le_of_lt",
"code": "protected theorem mul_lt_mul_of_le_of_lt (hac : a ≤ c) (hbd : b < d) (hc : 0 < c) :\n a * b < c * d",
"start": [
479,
1
],
"end": [
481,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_le_of_lt'",
"code": "protected theorem mul_lt_mul_of_le_of_lt' (hac : a ≤ c) (hbd : b < d) (ha : 0 < a) :\n a * b < c * d",
"start": [
483,
1
],
"end": [
485,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_lt_mul_of_lt_of_lt",
"code": "protected theorem mul_lt_mul_of_lt_of_lt {a b c d : Nat} (hac : a < c) (hbd : b < d) :\n a * b < c * d",
"start": [
487,
1
],
"end": [
489,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_mul_succ",
"code": "theorem succ_mul_succ (a b) : succ a * succ b = a * b + a + b + 1",
"start": [
491,
1
],
"end": [
492,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_one_mul_add_one",
"code": "theorem add_one_mul_add_one (a b : Nat) : (a + 1) * (b + 1) = a * b + a + b + 1",
"start": [
494,
1
],
"end": [
495,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_le_add_right",
"code": "theorem mul_le_add_right (m k n : Nat) : k * m ≤ m + n ↔ (k-1) * m ≤ n",
"start": [
497,
1
],
"end": [
502,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.succ_mul_succ_eq",
"code": "theorem succ_mul_succ_eq (a b : Nat) : succ a * succ b = a * b + a + b + 1",
"start": [
504,
1
],
"end": [
505,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_self_sub_mul_self_eq",
"code": "protected theorem mul_self_sub_mul_self_eq (a b : Nat) : a * a - b * b = (a + b) * (a - b)",
"start": [
507,
1
],
"end": [
509,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_mul_pos_left",
"code": "protected theorem pos_of_mul_pos_left {a b : Nat} (h : 0 < a * b) : 0 < b",
"start": [
511,
1
],
"end": [
514,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pos_of_mul_pos_right",
"code": "protected theorem pos_of_mul_pos_right {a b : Nat} (h : 0 < a * b) : 0 < a",
"start": [
516,
1
],
"end": [
519,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pos_iff_of_pos_left",
"code": "@[simp] protected theorem mul_pos_iff_of_pos_left {a b : Nat} (h : 0 < a) :\n 0 < a * b ↔ 0 < b",
"start": [
521,
1
],
"end": [
523,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pos_iff_of_pos_right",
"code": "@[simp] protected theorem mul_pos_iff_of_pos_right {a b : Nat} (h : 0 < b) :\n 0 < a * b ↔ 0 < a",
"start": [
525,
1
],
"end": [
527,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_two_eq_zero_or_one",
"code": "theorem mod_two_eq_zero_or_one (n : Nat) : n % 2 = 0 ∨ n % 2 = 1",
"start": [
531,
1
],
"end": [
534,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_of_mod_lt",
"code": "theorem le_of_mod_lt {a b : Nat} (h : a % b < a) : b ≤ a",
"start": [
536,
1
],
"end": [
537,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mod_mul_right",
"code": "theorem mul_mod_mul_right (z x y : Nat) : (x * z) % (y * z) = (x % y) * z",
"start": [
539,
1
],
"end": [
540,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.sub_mul_mod",
"code": "theorem sub_mul_mod {x k n : Nat} (h₁ : n*k ≤ x) : (x - n*k) % n = x % n",
"start": [
542,
1
],
"end": [
551,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_mod",
"code": "@[simp] theorem mod_mod (a n : Nat) : (a % n) % n = a % n",
"start": [
553,
1
],
"end": [
556,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_mod",
"code": "theorem mul_mod (a b n : Nat) : a * b % n = (a % n) * (b % n) % n",
"start": [
558,
1
],
"end": [
563,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_add_mod",
"code": "@[simp] theorem mod_add_mod (m n k : Nat) : (m % n + k) % n = (m + k) % n",
"start": [
565,
1
],
"end": [
567,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mod_mod",
"code": "@[simp] theorem add_mod_mod (m n k : Nat) : (m + n % k) % k = (m + n) % k",
"start": [
569,
1
],
"end": [
570,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.add_mod",
"code": "theorem add_mod (a b n : Nat) : (a + b) % n = ((a % n) + (b % n)) % n",
"start": [
572,
1
],
"end": [
573,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_succ'",
"code": "theorem pow_succ' {m n : Nat} : m ^ n.succ = m * m ^ n",
"start": [
577,
1
],
"end": [
578,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_add_one'",
"code": "theorem pow_add_one' {m n : Nat} : m ^ (n + 1) = m * m ^ n",
"start": [
580,
1
],
"end": [
581,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_eq",
"code": "@[simp] theorem pow_eq {m n : Nat} : m.pow n = m ^ n",
"start": [
583,
1
],
"end": [
583,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_shiftLeft",
"code": "theorem one_shiftLeft (n : Nat) : 1 <<< n = 2 ^ n",
"start": [
585,
1
],
"end": [
585,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_pow",
"code": "protected theorem zero_pow {n : Nat} (H : 0 < n) : 0 ^ n = 0",
"start": [
589,
1
],
"end": [
592,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_pow",
"code": "@[simp] protected theorem one_pow (n : Nat) : 1 ^ n = 1",
"start": [
594,
1
],
"end": [
597,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_one",
"code": "@[simp] protected theorem pow_one (a : Nat) : a ^ 1 = a",
"start": [
599,
1
],
"end": [
600,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_two",
"code": "protected theorem pow_two (a : Nat) : a ^ 2 = a * a",
"start": [
602,
1
],
"end": [
602,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_add",
"code": "protected theorem pow_add (a m n : Nat) : a ^ (m + n) = a ^ m * a ^ n",
"start": [
604,
1
],
"end": [
607,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_add'",
"code": "protected theorem pow_add' (a m n : Nat) : a ^ (m + n) = a ^ n * a ^ m",
"start": [
609,
1
],
"end": [
610,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_mul",
"code": "protected theorem pow_mul (a m n : Nat) : a ^ (m * n) = (a ^ m) ^ n",
"start": [
612,
1
],
"end": [
615,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_mul'",
"code": "protected theorem pow_mul' (a m n : Nat) : a ^ (m * n) = (a ^ n) ^ m",
"start": [
617,
1
],
"end": [
618,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_right_comm",
"code": "protected theorem pow_right_comm (a m n : Nat) : (a ^ m) ^ n = (a ^ n) ^ m",
"start": [
620,
1
],
"end": [
621,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_pow",
"code": "protected theorem mul_pow (a b n : Nat) : (a * b) ^ n = a ^ n * b ^ n",
"start": [
623,
1
],
"end": [
626,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_left",
"code": "protected abbrev pow_le_pow_left := @pow_le_pow_of_le_left",
"start": [
628,
1
],
"end": [
628,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_right",
"code": "protected abbrev pow_le_pow_right := @pow_le_pow_of_le_right",
"start": [
629,
1
],
"end": [
629,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_lt_two_pow",
"code": "protected theorem one_lt_two_pow (h : n ≠ 0) : 1 < 2 ^ n",
"start": [
631,
1
],
"end": [
635,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_lt_two_pow_iff",
"code": "@[simp] protected theorem one_lt_two_pow_iff : 1 < 2 ^ n ↔ n ≠ 0",
"start": [
637,
1
],
"end": [
638,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.one_le_two_pow",
"code": "protected theorem one_le_two_pow : 1 ≤ 2 ^ n",
"start": [
640,
1
],
"end": [
644,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_pos",
"code": "protected theorem pow_pos (h : 0 < a) : 0 < a^n",
"start": [
646,
1
],
"end": [
649,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_lt_pow_succ",
"code": "protected theorem pow_lt_pow_succ (h : 1 < a) : a ^ n < a ^ (n + 1)",
"start": [
651,
1
],
"end": [
653,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_lt_pow_of_lt",
"code": "protected theorem pow_lt_pow_of_lt {a n m : Nat} (h : 1 < a) (w : n < m) : a ^ n < a ^ m",
"start": [
655,
1
],
"end": [
663,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_of_le",
"code": "protected theorem pow_le_pow_of_le {a n m : Nat} (h : 1 < a) (w : n ≤ m) : a ^ n ≤ a ^ m",
"start": [
665,
1
],
"end": [
671,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_le_pow_iff_right",
"code": "protected theorem pow_le_pow_iff_right {a n m : Nat} (h : 1 < a) :\n a ^ n ≤ a ^ m ↔ n ≤ m",
"start": [
673,
1
],
"end": [
684,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_lt_pow_iff_right",
"code": "protected theorem pow_lt_pow_iff_right {a n m : Nat} (h : 1 < a) :\n a ^ n < a ^ m ↔ n < m",
"start": [
686,
1
],
"end": [
695,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.log2_zero",
"code": "@[simp]\ntheorem log2_zero : Nat.log2 0 = 0",
"start": [
699,
1
],
"end": [
701,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.le_log2",
"code": "theorem le_log2 (h : n ≠ 0) : k ≤ n.log2 ↔ 2 ^ k ≤ n",
"start": [
703,
1
],
"end": [
714,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.log2_lt",
"code": "theorem log2_lt (h : n ≠ 0) : n.log2 < k ↔ n < 2 ^ k",
"start": [
716,
1
],
"end": [
717,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.log2_self_le",
"code": "theorem log2_self_le (h : n ≠ 0) : 2 ^ n.log2 ≤ n",
"start": [
719,
1
],
"end": [
719,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.lt_log2_self",
"code": "theorem lt_log2_self : n < 2 ^ (n.log2 + 1)",
"start": [
721,
1
],
"end": [
724,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.eq_mul_of_div_eq_right",
"code": "protected theorem eq_mul_of_div_eq_right {a b c : Nat} (H1 : b ∣ a) (H2 : a / b = c) :\n a = b * c",
"start": [
728,
1
],
"end": [
730,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_iff_eq_mul_right",
"code": "protected theorem div_eq_iff_eq_mul_right {a b c : Nat} (H : 0 < b) (H' : b ∣ a) :\n a / b = c ↔ a = b * c",
"start": [
732,
1
],
"end": [
734,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.div_eq_iff_eq_mul_left",
"code": "protected theorem div_eq_iff_eq_mul_left {a b c : Nat} (H : 0 < b) (H' : b ∣ a) :\n a / b = c ↔ a = c * b",
"start": [
736,
1
],
"end": [
738,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_dvd_pow_iff_pow_le_pow",
"code": "theorem pow_dvd_pow_iff_pow_le_pow {k l : Nat} :\n ∀ {x : Nat}, 0 < x → (x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l)",
"start": [
740,
1
],
"end": [
753,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_dvd_pow_iff_le_right",
"code": "theorem pow_dvd_pow_iff_le_right {x k l : Nat} (w : 1 < x) : x ^ k ∣ x ^ l ↔ k ≤ l",
"start": [
755,
1
],
"end": [
757,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_dvd_pow_iff_le_right'",
"code": "theorem pow_dvd_pow_iff_le_right' {b k l : Nat} : (b + 2) ^ k ∣ (b + 2) ^ l ↔ k ≤ l",
"start": [
759,
1
],
"end": [
760,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_dvd_pow",
"code": "protected theorem pow_dvd_pow {m n : Nat} (a : Nat) (h : m ≤ n) : a ^ m ∣ a ^ n",
"start": [
762,
1
],
"end": [
767,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_sub_mul_pow",
"code": "protected theorem pow_sub_mul_pow (a : Nat) {m n : Nat} (h : m ≤ n) :\n a ^ (n - m) * a ^ m = a ^ n",
"start": [
769,
1
],
"end": [
771,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_dvd_of_le_of_pow_dvd",
"code": "theorem pow_dvd_of_le_of_pow_dvd {p m n k : Nat} (hmn : m ≤ n) (hdiv : p ^ n ∣ k) : p ^ m ∣ k",
"start": [
773,
1
],
"end": [
774,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.dvd_of_pow_dvd",
"code": "theorem dvd_of_pow_dvd {p k m : Nat} (hk : 1 ≤ k) (hpk : p ^ k ∣ m) : p ∣ m",
"start": [
776,
1
],
"end": [
777,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.pow_div",
"code": "protected theorem pow_div {x m n : Nat} (h : n ≤ m) (hx : 0 < x) : x ^ m / x ^ n = x ^ (m - n)",
"start": [
779,
1
],
"end": [
780,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_zero",
"code": "@[simp] theorem shiftLeft_zero : n <<< 0 = n",
"start": [
784,
1
],
"end": [
784,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_succ_inside",
"code": "theorem shiftLeft_succ_inside (m n : Nat) : m <<< (n+1) = (2*m) <<< n",
"start": [
786,
1
],
"end": [
787,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_succ",
"code": "theorem shiftLeft_succ : ∀(m n), m <<< (n + 1) = 2 * (m <<< n)",
"start": [
789,
1
],
"end": [
794,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftRight_succ_inside",
"code": "theorem shiftRight_succ_inside : ∀m n, m >>> (n+1) = (m/2) >>> n",
"start": [
796,
1
],
"end": [
801,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_shiftLeft",
"code": "@[simp] theorem zero_shiftLeft : ∀ n, 0 <<< n = 0",
"start": [
803,
1
],
"end": [
805,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.zero_shiftRight",
"code": "@[simp] theorem zero_shiftRight : ∀ n, 0 >>> n = 0",
"start": [
807,
1
],
"end": [
809,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_add",
"code": "theorem shiftLeft_add (m n : Nat) : ∀ k, m <<< (n + k) = (m <<< n) <<< k",
"start": [
811,
1
],
"end": [
813,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_shiftLeft",
"code": "@[deprecated shiftLeft_add (since := \"2024-06-02\")]\ntheorem shiftLeft_shiftLeft (m n : Nat) : ∀ k, (m <<< n) <<< k = m <<< (n + k)",
"start": [
815,
1
],
"end": [
818,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.shiftLeft_shiftRight",
"code": "@[simp] theorem shiftLeft_shiftRight (x n : Nat) : x <<< n >>> n = x",
"start": [
820,
1
],
"end": [
821,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_add_div",
"code": "theorem mul_add_div {m : Nat} (m_pos : m > 0) (x y : Nat) : (m * x + y) / m = x + y / m",
"start": [
823,
1
],
"end": [
828,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mul_add_mod",
"code": "theorem mul_add_mod (m x y : Nat) : (m * x + y) % m = y % m",
"start": [
830,
1
],
"end": [
834,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_div_self",
"code": "@[simp] theorem mod_div_self (m n : Nat) : m % n / n = 0",
"start": [
836,
1
],
"end": [
839,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidableBallLT",
"code": "instance decidableBallLT :\n ∀ (n : Nat) (P : ∀ k, k < n → Prop) [∀ n h, Decidable (P n h)], Decidable (∀ n h, P n h)\n| 0, _, _ => isTrue fun _ => (by cases ·)\n| n + 1, P, H =>\n match decidableBallLT n (P · <| lt_succ_of_lt ·) with\n | isFalse h => isFalse (h fun _ _ => · _ _)\n | isTrue h =>\n match H n Nat.le.refl with\n | isFalse p => isFalse (p <| · _ _)\n | isTrue p => isTrue fun _ h' => (Nat.lt_succ_iff_lt_or_eq.1 h').elim (h _) fun hn => hn ▸ p",
"start": [
843,
1
],
"end": [
852,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidableForallFin",
"code": "instance decidableForallFin (P : Fin n → Prop) [DecidablePred P] : Decidable (∀ i, P i) :=\n decidable_of_iff (∀ k h, P ⟨k, h⟩) ⟨fun m ⟨k, h⟩ => m k h, fun m k h => m ⟨k, h⟩⟩",
"start": [
854,
1
],
"end": [
855,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidableBallLE",
"code": "instance decidableBallLE (n : Nat) (P : ∀ k, k ≤ n → Prop) [∀ n h, Decidable (P n h)] :\n Decidable (∀ n h, P n h) :=\n decidable_of_iff (∀ (k) (h : k < succ n), P k (le_of_lt_succ h))\n ⟨fun m k h => m k (lt_succ_of_le h), fun m k _ => m k _⟩",
"start": [
857,
1
],
"end": [
860,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidableExistsLT",
"code": "instance decidableExistsLT [h : DecidablePred p] : DecidablePred fun n => ∃ m : Nat, m < n ∧ p m\n | 0 => isFalse (by simp only [not_lt_zero, false_and, exists_const, not_false_eq_true])\n | n + 1 =>\n @decidable_of_decidable_of_iff _ _ (@instDecidableOr _ _ (decidableExistsLT (p := p) n) (h n))\n (by simp only [Nat.lt_succ_iff_lt_or_eq, or_and_right, exists_or, exists_eq_left])",
"start": [
862,
1
],
"end": [
866,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.decidableExistsLE",
"code": "instance decidableExistsLE [DecidablePred p] : DecidablePred fun n => ∃ m : Nat, m ≤ n ∧ p m :=\n fun n => decidable_of_iff (∃ m, m < n + 1 ∧ p m)\n (exists_congr fun _ => and_congr_left' Nat.lt_succ_iff)",
"start": [
868,
1
],
"end": [
870,
60
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Fin/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Omega.lean",
".lake/packages/lean4/src/lean/Init/Ext.lean",
".lake/packages/lean4/src/lean/Init/Data/Fin/Basic.lean",
".lake/packages/lean4/src/lean/Init/Conv.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/ByCases.lean"
] | [
{
"full_name": "Fin.size_pos",
"code": "theorem size_pos (i : Fin n) : 0 < n",
"start": [
19,
1
],
"end": [
20,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mod_def",
"code": "theorem mod_def (a m : Fin n) : a % m = Fin.mk (a % m) (Nat.lt_of_le_of_lt (Nat.mod_le _ _) a.2)",
"start": [
22,
1
],
"end": [
23,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul_def",
"code": "theorem mul_def (a b : Fin n) : a * b = Fin.mk ((a * b) % n) (Nat.mod_lt _ a.size_pos)",
"start": [
25,
1
],
"end": [
25,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.sub_def",
"code": "theorem sub_def (a b : Fin n) : a - b = Fin.mk (((n - b) + a) % n) (Nat.mod_lt _ a.size_pos)",
"start": [
27,
1
],
"end": [
27,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.size_pos'",
"code": "theorem size_pos' : ∀ [Nonempty (Fin n)], 0 < n",
"start": [
29,
1
],
"end": [
29,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.is_lt",
"code": "@[simp] theorem is_lt (a : Fin n) : (a : Nat) < n",
"start": [
31,
1
],
"end": [
31,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pos_iff_nonempty",
"code": "theorem pos_iff_nonempty {n : Nat} : 0 < n ↔ Nonempty (Fin n)",
"start": [
33,
1
],
"end": [
34,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eta",
"code": "@[simp] protected theorem eta (a : Fin n) (h : a < n) : (⟨a, h⟩ : Fin n) = a",
"start": [
38,
1
],
"end": [
38,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ext",
"code": "@[ext] theorem ext {a b : Fin n} (h : (a : Nat) = b) : a = b",
"start": [
40,
1
],
"end": [
40,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ext_iff",
"code": "theorem ext_iff {a b : Fin n} : a = b ↔ a.1 = b.1",
"start": [
42,
1
],
"end": [
42,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_ne_iff",
"code": "theorem val_ne_iff {a b : Fin n} : a.1 ≠ b.1 ↔ a ≠ b",
"start": [
44,
1
],
"end": [
44,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.forall_iff",
"code": "theorem forall_iff {p : Fin n → Prop} : (∀ i, p i) ↔ ∀ i h, p ⟨i, h⟩",
"start": [
46,
1
],
"end": [
47,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk.inj_iff",
"code": "protected theorem mk.inj_iff {n a b : Nat} {ha : a < n} {hb : b < n} :\n (⟨a, ha⟩ : Fin n) = ⟨b, hb⟩ ↔ a = b",
"start": [
49,
1
],
"end": [
50,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_mk",
"code": "theorem val_mk {m n : Nat} (h : m < n) : (⟨m, h⟩ : Fin n).val = m",
"start": [
52,
1
],
"end": [
52,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eq_mk_iff_val_eq",
"code": "theorem eq_mk_iff_val_eq {a : Fin n} {k : Nat} {hk : k < n} :\n a = ⟨k, hk⟩ ↔ (a : Nat) = k",
"start": [
54,
1
],
"end": [
55,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_val",
"code": "theorem mk_val (i : Fin n) : (⟨i, i.isLt⟩ : Fin n) = i",
"start": [
57,
1
],
"end": [
57,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_ofNat'",
"code": "@[simp] theorem val_ofNat' (a : Nat) (is_pos : n > 0) :\n (Fin.ofNat' a is_pos).val = a % n",
"start": [
59,
1
],
"end": [
60,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ofNat'_zero_val",
"code": "@[deprecated ofNat'_zero_val (since := \"2024-02-22\")]\ntheorem ofNat'_zero_val : (Fin.ofNat' 0 h).val = 0",
"start": [
62,
1
],
"end": [
63,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mod_val",
"code": "@[simp] theorem mod_val (a b : Fin n) : (a % b).val = a.val % b.val",
"start": [
65,
1
],
"end": [
66,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.div_val",
"code": "@[simp] theorem div_val (a b : Fin n) : (a / b).val = a.val / b.val",
"start": [
68,
1
],
"end": [
69,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.modn_val",
"code": "@[simp] theorem modn_val (a : Fin n) (b : Nat) : (a.modn b).val = a.val % b",
"start": [
71,
1
],
"end": [
72,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ite_val",
"code": "theorem ite_val {n : Nat} {c : Prop} [Decidable c] {x : c → Fin n} (y : ¬c → Fin n) :\n (if h : c then x h else y h).val = if h : c then (x h).val else (y h).val",
"start": [
74,
1
],
"end": [
76,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.dite_val",
"code": "theorem dite_val {n : Nat} {c : Prop} [Decidable c] {x y : Fin n} :\n (if c then x else y).val = if c then x.val else y.val",
"start": [
78,
1
],
"end": [
80,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_def",
"code": "theorem le_def {a b : Fin n} : a ≤ b ↔ a.1 ≤ b.1",
"start": [
84,
1
],
"end": [
84,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_def",
"code": "theorem lt_def {a b : Fin n} : a < b ↔ a.1 < b.1",
"start": [
86,
1
],
"end": [
86,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_iff_val_lt_val",
"code": "theorem lt_iff_val_lt_val {a b : Fin n} : a < b ↔ a.val < b.val",
"start": [
88,
1
],
"end": [
88,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.not_le",
"code": "@[simp] protected theorem not_le {a b : Fin n} : ¬ a ≤ b ↔ b < a",
"start": [
90,
1
],
"end": [
90,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.not_lt",
"code": "@[simp] protected theorem not_lt {a b : Fin n} : ¬ a < b ↔ b ≤ a",
"start": [
92,
1
],
"end": [
92,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_refl",
"code": "@[simp] protected theorem le_refl (a : Fin n) : a ≤ a",
"start": [
94,
1
],
"end": [
94,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl (a : Fin n) : ¬ a < a",
"start": [
96,
1
],
"end": [
96,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_trans",
"code": "protected theorem le_trans {a b c : Fin n} : a ≤ b → b ≤ c → a ≤ c",
"start": [
98,
1
],
"end": [
98,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_trans",
"code": "protected theorem lt_trans {a b c : Fin n} : a < b → b < c → a < c",
"start": [
100,
1
],
"end": [
100,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_total",
"code": "protected theorem le_total (a b : Fin n) : a ≤ b ∨ b ≤ a",
"start": [
102,
1
],
"end": [
102,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_asymm",
"code": "protected theorem lt_asymm {a b : Fin n} (h : a < b) : ¬ b < a",
"start": [
104,
1
],
"end": [
104,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ne_of_lt",
"code": "protected theorem ne_of_lt {a b : Fin n} (h : a < b) : a ≠ b",
"start": [
106,
1
],
"end": [
106,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ne_of_gt",
"code": "protected theorem ne_of_gt {a b : Fin n} (h : a < b) : b ≠ a",
"start": [
108,
1
],
"end": [
108,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_of_lt",
"code": "protected theorem le_of_lt {a b : Fin n} (h : a < b) : a ≤ b",
"start": [
110,
1
],
"end": [
110,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.is_le",
"code": "theorem is_le (i : Fin (n + 1)) : i ≤ n",
"start": [
112,
1
],
"end": [
112,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.is_le'",
"code": "@[simp] theorem is_le' {a : Fin n} : a ≤ n",
"start": [
114,
1
],
"end": [
114,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_lt_of_lt_val",
"code": "theorem mk_lt_of_lt_val {b : Fin n} {a : Nat} (h : a < b) :\n (⟨a, Nat.lt_trans h b.is_lt⟩ : Fin n) < b",
"start": [
116,
1
],
"end": [
117,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_le_of_le_val",
"code": "theorem mk_le_of_le_val {b : Fin n} {a : Nat} (h : a ≤ b) :\n (⟨a, Nat.lt_of_le_of_lt h b.is_lt⟩ : Fin n) ≤ b",
"start": [
119,
1
],
"end": [
120,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_le_mk",
"code": "@[simp] theorem mk_le_mk {x y : Nat} {hx hy} : (⟨x, hx⟩ : Fin n) ≤ ⟨y, hy⟩ ↔ x ≤ y",
"start": [
122,
1
],
"end": [
122,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_lt_mk",
"code": "@[simp] theorem mk_lt_mk {x y : Nat} {hx hy} : (⟨x, hx⟩ : Fin n) < ⟨y, hy⟩ ↔ x < y",
"start": [
124,
1
],
"end": [
124,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_zero",
"code": "@[simp] theorem val_zero (n : Nat) : (0 : Fin (n + 1)).1 = 0",
"start": [
126,
1
],
"end": [
126,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_zero",
"code": "@[simp] theorem mk_zero : (⟨0, Nat.succ_pos n⟩ : Fin (n + 1)) = 0",
"start": [
128,
1
],
"end": [
128,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.zero_le",
"code": "@[simp] theorem zero_le (a : Fin (n + 1)) : 0 ≤ a",
"start": [
130,
1
],
"end": [
130,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.zero_lt_one",
"code": "theorem zero_lt_one : (0 : Fin (n + 2)) < 1",
"start": [
132,
1
],
"end": [
132,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.not_lt_zero",
"code": "@[simp] theorem not_lt_zero (a : Fin (n + 1)) : ¬a < 0",
"start": [
134,
1
],
"end": [
134,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pos_iff_ne_zero",
"code": "theorem pos_iff_ne_zero {a : Fin (n + 1)} : 0 < a ↔ a ≠ 0",
"start": [
136,
1
],
"end": [
137,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eq_zero_or_eq_succ",
"code": "theorem eq_zero_or_eq_succ {n : Nat} : ∀ i : Fin (n + 1), i = 0 ∨ ∃ j : Fin n, i = j.succ",
"start": [
139,
1
],
"end": [
141,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eq_succ_of_ne_zero",
"code": "theorem eq_succ_of_ne_zero {n : Nat} {i : Fin (n + 1)} (hi : i ≠ 0) : ∃ j : Fin n, i = j.succ",
"start": [
143,
1
],
"end": [
144,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_rev",
"code": "@[simp] theorem val_rev (i : Fin n) : rev i = n - (i + 1)",
"start": [
146,
1
],
"end": [
146,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_rev",
"code": "@[simp] theorem rev_rev (i : Fin n) : rev (rev i) = i",
"start": [
148,
1
],
"end": [
149,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_le_rev",
"code": "@[simp] theorem rev_le_rev {i j : Fin n} : rev i ≤ rev j ↔ j ≤ i",
"start": [
151,
1
],
"end": [
153,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_inj",
"code": "@[simp] theorem rev_inj {i j : Fin n} : rev i = rev j ↔ i = j",
"start": [
155,
1
],
"end": [
156,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_eq",
"code": "theorem rev_eq {n a : Nat} (i : Fin (n + 1)) (h : n = a + i) :\n rev i = ⟨a, Nat.lt_succ_of_le (h ▸ Nat.le_add_right ..)⟩",
"start": [
158,
1
],
"end": [
162,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_lt_rev",
"code": "@[simp] theorem rev_lt_rev {i j : Fin n} : rev i < rev j ↔ j < i",
"start": [
164,
1
],
"end": [
165,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_last",
"code": "@[simp] theorem val_last (n : Nat) : last n = n",
"start": [
167,
1
],
"end": [
167,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_last",
"code": "theorem le_last (i : Fin (n + 1)) : i ≤ last n",
"start": [
169,
1
],
"end": [
169,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.last_pos",
"code": "theorem last_pos : (0 : Fin (n + 2)) < last (n + 1)",
"start": [
171,
1
],
"end": [
171,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.eq_last_of_not_lt",
"code": "theorem eq_last_of_not_lt {i : Fin (n + 1)} (h : ¬(i : Nat) < n) : i = last n",
"start": [
173,
1
],
"end": [
174,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_lt_last",
"code": "theorem val_lt_last {i : Fin (n + 1)} : i ≠ last n → (i : Nat) < n",
"start": [
176,
1
],
"end": [
177,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_last",
"code": "@[simp] theorem rev_last (n : Nat) : rev (last n) = 0",
"start": [
179,
1
],
"end": [
179,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_zero",
"code": "@[simp] theorem rev_zero (n : Nat) : rev 0 = last n",
"start": [
181,
1
],
"end": [
182,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_one",
"code": "@[simp] theorem val_one (n : Nat) : (1 : Fin (n + 2)).val = 1",
"start": [
186,
1
],
"end": [
186,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_one",
"code": "@[simp] theorem mk_one : (⟨1, Nat.succ_lt_succ (Nat.succ_pos n)⟩ : Fin (n + 2)) = (1 : Fin _)",
"start": [
188,
1
],
"end": [
188,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subsingleton_iff_le_one",
"code": "theorem subsingleton_iff_le_one : Subsingleton (Fin n) ↔ n ≤ 1",
"start": [
190,
1
],
"end": [
194,
96
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subsingleton_zero",
"code": "instance subsingleton_zero : Subsingleton (Fin 0) := subsingleton_iff_le_one.2 (by decide)",
"start": [
196,
1
],
"end": [
196,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subsingleton_one",
"code": "instance subsingleton_one : Subsingleton (Fin 1) := subsingleton_iff_le_one.2 (by decide)",
"start": [
198,
1
],
"end": [
198,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.fin_one_eq_zero",
"code": "theorem fin_one_eq_zero (a : Fin 1) : a = 0",
"start": [
200,
1
],
"end": [
200,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add_def",
"code": "theorem add_def (a b : Fin n) : a + b = Fin.mk ((a + b) % n) (Nat.mod_lt _ a.size_pos)",
"start": [
202,
1
],
"end": [
202,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_add",
"code": "theorem val_add (a b : Fin n) : (a + b).val = (a.val + b.val) % n",
"start": [
204,
1
],
"end": [
204,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_add_one_of_lt",
"code": "theorem val_add_one_of_lt {n : Nat} {i : Fin n.succ} (h : i < last _) : (i + 1).1 = i + 1",
"start": [
206,
1
],
"end": [
209,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.last_add_one",
"code": "@[simp] theorem last_add_one : ∀ n, last n + 1 = 0",
"start": [
211,
1
],
"end": [
213,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_add_one",
"code": "theorem val_add_one {n : Nat} (i : Fin (n + 1)) :\n ((i + 1 : Fin (n + 1)) : Nat) = if i = last _ then (0 : Nat) else i + 1",
"start": [
215,
1
],
"end": [
219,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_two",
"code": "@[simp] theorem val_two {n : Nat} : (2 : Fin (n + 3)).val = 2",
"start": [
221,
1
],
"end": [
221,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add_one_pos",
"code": "theorem add_one_pos (i : Fin (n + 1)) (h : i < Fin.last n) : (0 : Fin (n + 1)) < i + 1",
"start": [
223,
1
],
"end": [
229,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.one_pos",
"code": "theorem one_pos : (0 : Fin (n + 2)) < 1",
"start": [
231,
1
],
"end": [
231,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.zero_ne_one",
"code": "theorem zero_ne_one : (0 : Fin (n + 2)) ≠ 1",
"start": [
233,
1
],
"end": [
233,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_succ",
"code": "@[simp] theorem val_succ (j : Fin n) : (j.succ : Nat) = j + 1",
"start": [
237,
1
],
"end": [
237,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_pos",
"code": "@[simp] theorem succ_pos (a : Fin n) : (0 : Fin (n + 1)) < a.succ",
"start": [
239,
1
],
"end": [
240,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_le_succ_iff",
"code": "@[simp] theorem succ_le_succ_iff {a b : Fin n} : a.succ ≤ b.succ ↔ a ≤ b",
"start": [
242,
1
],
"end": [
242,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_lt_succ_iff",
"code": "@[simp] theorem succ_lt_succ_iff {a b : Fin n} : a.succ < b.succ ↔ a < b",
"start": [
244,
1
],
"end": [
244,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_inj",
"code": "@[simp] theorem succ_inj {a b : Fin n} : a.succ = b.succ ↔ a = b",
"start": [
246,
1
],
"end": [
248,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_ne_zero",
"code": "theorem succ_ne_zero {n} : ∀ k : Fin n, Fin.succ k ≠ 0",
"start": [
250,
1
],
"end": [
251,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_zero_eq_one",
"code": "@[simp] theorem succ_zero_eq_one : Fin.succ (0 : Fin (n + 1)) = 1",
"start": [
253,
1
],
"end": [
253,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_one_eq_two",
"code": "@[simp] theorem succ_one_eq_two : Fin.succ (1 : Fin (n + 2)) = 2",
"start": [
255,
1
],
"end": [
256,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_mk",
"code": "@[simp] theorem succ_mk (n i : Nat) (h : i < n) :\n Fin.succ ⟨i, h⟩ = ⟨i + 1, Nat.succ_lt_succ h⟩",
"start": [
258,
1
],
"end": [
259,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mk_succ_pos",
"code": "theorem mk_succ_pos (i : Nat) (h : i < n) :\n (0 : Fin (n + 1)) < ⟨i.succ, Nat.add_lt_add_right h 1⟩",
"start": [
261,
1
],
"end": [
263,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.one_lt_succ_succ",
"code": "theorem one_lt_succ_succ (a : Fin n) : (1 : Fin (n + 2)) < a.succ.succ",
"start": [
265,
1
],
"end": [
267,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add_one_lt_iff",
"code": "@[simp] theorem add_one_lt_iff {n : Nat} {k : Fin (n + 2)} : k + 1 < k ↔ k = last _",
"start": [
269,
1
],
"end": [
274,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add_one_le_iff",
"code": "@[simp] theorem add_one_le_iff {n : Nat} : ∀ {k : Fin (n + 1)}, k + 1 ≤ k ↔ k = last _",
"start": [
276,
1
],
"end": [
285,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.last_le_iff",
"code": "@[simp] theorem last_le_iff {n : Nat} {k : Fin (n + 1)} : last n ≤ k ↔ k = last n",
"start": [
287,
1
],
"end": [
288,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_add_one_iff",
"code": "@[simp] theorem lt_add_one_iff {n : Nat} {k : Fin (n + 1)} : k < k + 1 ↔ k < last n",
"start": [
290,
1
],
"end": [
291,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_zero_iff",
"code": "@[simp] theorem le_zero_iff {n : Nat} {k : Fin (n + 1)} : k ≤ 0 ↔ k = 0",
"start": [
293,
1
],
"end": [
294,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_succ_ne_one",
"code": "theorem succ_succ_ne_one (a : Fin n) : Fin.succ (Fin.succ a) ≠ 1",
"start": [
296,
1
],
"end": [
297,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_castLT",
"code": "@[simp] theorem coe_castLT (i : Fin m) (h : i.1 < n) : (castLT i h : Nat) = i",
"start": [
299,
1
],
"end": [
299,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLT_mk",
"code": "@[simp] theorem castLT_mk (i n m : Nat) (hn : i < n) (hm : i < m) : castLT ⟨i, hn⟩ hm = ⟨i, hm⟩",
"start": [
301,
1
],
"end": [
302,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_castLE",
"code": "@[simp] theorem coe_castLE (h : n ≤ m) (i : Fin n) : (castLE h i : Nat) = i",
"start": [
304,
1
],
"end": [
304,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_mk",
"code": "@[simp] theorem castLE_mk (i n m : Nat) (hn : i < n) (h : n ≤ m) :\n castLE h ⟨i, hn⟩ = ⟨i, Nat.lt_of_lt_of_le hn h⟩",
"start": [
306,
1
],
"end": [
307,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_zero",
"code": "@[simp] theorem castLE_zero {n m : Nat} (h : n.succ ≤ m.succ) : castLE h 0 = 0",
"start": [
309,
1
],
"end": [
309,
100
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_succ",
"code": "@[simp] theorem castLE_succ {m n : Nat} (h : m + 1 ≤ n + 1) (i : Fin m) :\n castLE h i.succ = (castLE (Nat.succ_le_succ_iff.mp h) i).succ",
"start": [
311,
1
],
"end": [
312,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_castLE",
"code": "@[simp] theorem castLE_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) (i : Fin k) :\n Fin.castLE mn (Fin.castLE km i) = Fin.castLE (Nat.le_trans km mn) i",
"start": [
314,
1
],
"end": [
316,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_comp_castLE",
"code": "@[simp] theorem castLE_comp_castLE {k m n} (km : k ≤ m) (mn : m ≤ n) :\n Fin.castLE mn ∘ Fin.castLE km = Fin.castLE (Nat.le_trans km mn)",
"start": [
318,
1
],
"end": [
320,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_cast",
"code": "@[simp] theorem coe_cast (h : n = m) (i : Fin n) : (cast h i : Nat) = i",
"start": [
322,
1
],
"end": [
322,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_last",
"code": "@[simp] theorem cast_last {n' : Nat} {h : n + 1 = n' + 1} : cast h (last n) = last n'",
"start": [
324,
1
],
"end": [
325,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_mk",
"code": "@[simp] theorem cast_mk (h : n = m) (i : Nat) (hn : i < n) : cast h ⟨i, hn⟩ = ⟨i, h ▸ hn⟩",
"start": [
327,
1
],
"end": [
327,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_trans",
"code": "@[simp] theorem cast_trans {k : Nat} (h : n = m) (h' : m = k) {i : Fin n} :\n cast h' (cast h i) = cast (Eq.trans h h') i",
"start": [
329,
1
],
"end": [
330,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLE_of_eq",
"code": "theorem castLE_of_eq {m n : Nat} (h : m = n) {h' : m ≤ n} : castLE h' = Fin.cast h",
"start": [
332,
1
],
"end": [
332,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_castAdd",
"code": "@[simp] theorem coe_castAdd (m : Nat) (i : Fin n) : (castAdd m i : Nat) = i",
"start": [
334,
1
],
"end": [
334,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_zero",
"code": "@[simp] theorem castAdd_zero : (castAdd 0 : Fin n → Fin (n + 0)) = cast rfl",
"start": [
336,
1
],
"end": [
336,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_lt",
"code": "theorem castAdd_lt {m : Nat} (n : Nat) (i : Fin m) : (castAdd n i : Nat) < m",
"start": [
338,
1
],
"end": [
338,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_mk",
"code": "@[simp] theorem castAdd_mk (m : Nat) (i : Nat) (h : i < n) :\n castAdd m ⟨i, h⟩ = ⟨i, Nat.lt_add_right m h⟩",
"start": [
340,
1
],
"end": [
341,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_castLT",
"code": "@[simp] theorem castAdd_castLT (m : Nat) (i : Fin (n + m)) (hi : i.val < n) :\n castAdd m (castLT i hi) = i",
"start": [
343,
1
],
"end": [
344,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLT_castAdd",
"code": "@[simp] theorem castLT_castAdd (m : Nat) (i : Fin n) :\n castLT (castAdd m i) (castAdd_lt m i) = i",
"start": [
346,
1
],
"end": [
347,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_cast",
"code": "theorem castAdd_cast {n n' : Nat} (m : Nat) (i : Fin n') (h : n' = n) :\n castAdd m (Fin.cast h i) = Fin.cast (congrArg (. + m) h) (castAdd m i)",
"start": [
349,
1
],
"end": [
351,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_castAdd_left",
"code": "theorem cast_castAdd_left {n n' m : Nat} (i : Fin n') (h : n' + m = n + m) :\n cast h (castAdd m i) = castAdd m (cast (Nat.add_right_cancel h) i)",
"start": [
353,
1
],
"end": [
354,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_castAdd_right",
"code": "@[simp] theorem cast_castAdd_right {n m m' : Nat} (i : Fin n) (h : n + m' = n + m) :\n cast h (castAdd m' i) = castAdd m i",
"start": [
356,
1
],
"end": [
357,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_castAdd",
"code": "theorem castAdd_castAdd {m n p : Nat} (i : Fin m) :\n castAdd p (castAdd n i) = cast (Nat.add_assoc ..).symm (castAdd (n + p) i)",
"start": [
359,
1
],
"end": [
360,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_succ_eq",
"code": "@[simp] theorem cast_succ_eq {n' : Nat} (i : Fin n) (h : n.succ = n'.succ) :\n cast h i.succ = (cast (Nat.succ.inj h) i).succ",
"start": [
362,
1
],
"end": [
365,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_cast_eq",
"code": "theorem succ_cast_eq {n' : Nat} (i : Fin n) (h : n = n') :\n (cast h i).succ = cast (by rw [h]) i.succ",
"start": [
367,
1
],
"end": [
368,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_castSucc",
"code": "@[simp] theorem coe_castSucc (i : Fin n) : (Fin.castSucc i : Nat) = i",
"start": [
370,
1
],
"end": [
370,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_mk",
"code": "@[simp] theorem castSucc_mk (n i : Nat) (h : i < n) : castSucc ⟨i, h⟩ = ⟨i, Nat.lt.step h⟩",
"start": [
372,
1
],
"end": [
372,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_castSucc",
"code": "@[simp] theorem cast_castSucc {n' : Nat} {h : n + 1 = n' + 1} {i : Fin n} :\n cast h (castSucc i) = castSucc (cast (Nat.succ.inj h) i)",
"start": [
374,
1
],
"end": [
375,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_lt_succ",
"code": "theorem castSucc_lt_succ (i : Fin n) : Fin.castSucc i < i.succ",
"start": [
377,
1
],
"end": [
378,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_castSucc_iff",
"code": "theorem le_castSucc_iff {i : Fin (n + 1)} {j : Fin n} : i ≤ Fin.castSucc j ↔ i < j.succ",
"start": [
380,
1
],
"end": [
381,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_lt_iff_succ_le",
"code": "theorem castSucc_lt_iff_succ_le {n : Nat} {i : Fin n} {j : Fin (n + 1)} :\n Fin.castSucc i < j ↔ i.succ ≤ j",
"start": [
383,
1
],
"end": [
384,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_last",
"code": "@[simp] theorem succ_last (n : Nat) : (last n).succ = last n.succ",
"start": [
386,
1
],
"end": [
386,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_eq_last_succ",
"code": "@[simp] theorem succ_eq_last_succ {n : Nat} (i : Fin n.succ) :\n i.succ = last (n + 1) ↔ i = last n",
"start": [
388,
1
],
"end": [
389,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_castLT",
"code": "@[simp] theorem castSucc_castLT (i : Fin (n + 1)) (h : (i : Nat) < n) :\n castSucc (castLT i h) = i",
"start": [
391,
1
],
"end": [
392,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castLT_castSucc",
"code": "@[simp] theorem castLT_castSucc {n : Nat} (a : Fin n) (h : (a : Nat) < n) :\n castLT (castSucc a) h = a",
"start": [
394,
1
],
"end": [
395,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_lt_castSucc_iff",
"code": "@[simp] theorem castSucc_lt_castSucc_iff {a b : Fin n} :\n Fin.castSucc a < Fin.castSucc b ↔ a < b",
"start": [
397,
1
],
"end": [
398,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_inj",
"code": "theorem castSucc_inj {a b : Fin n} : castSucc a = castSucc b ↔ a = b",
"start": [
400,
1
],
"end": [
400,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_lt_last",
"code": "theorem castSucc_lt_last (a : Fin n) : castSucc a < last n",
"start": [
402,
1
],
"end": [
402,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_zero",
"code": "@[simp] theorem castSucc_zero : castSucc (0 : Fin (n + 1)) = 0",
"start": [
404,
1
],
"end": [
404,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_one",
"code": "@[simp] theorem castSucc_one {n : Nat} : castSucc (1 : Fin (n + 2)) = 1",
"start": [
406,
1
],
"end": [
406,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_pos",
"code": "theorem castSucc_pos {i : Fin (n + 1)} (h : 0 < i) : 0 < castSucc i",
"start": [
408,
1
],
"end": [
410,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_eq_zero_iff",
"code": "@[simp] theorem castSucc_eq_zero_iff (a : Fin (n + 1)) : castSucc a = 0 ↔ a = 0",
"start": [
412,
1
],
"end": [
412,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_ne_zero_iff",
"code": "theorem castSucc_ne_zero_iff (a : Fin (n + 1)) : castSucc a ≠ 0 ↔ a ≠ 0",
"start": [
414,
1
],
"end": [
415,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castSucc_fin_succ",
"code": "theorem castSucc_fin_succ (n : Nat) (j : Fin n) :\n castSucc (Fin.succ j) = Fin.succ (castSucc j)",
"start": [
417,
1
],
"end": [
418,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coeSucc_eq_succ",
"code": "@[simp]\ntheorem coeSucc_eq_succ {a : Fin n} : castSucc a + 1 = a.succ",
"start": [
420,
1
],
"end": [
424,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lt_succ",
"code": "theorem lt_succ {a : Fin n} : castSucc a < a.succ",
"start": [
426,
1
],
"end": [
427,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.exists_castSucc_eq",
"code": "theorem exists_castSucc_eq {n : Nat} {i : Fin (n + 1)} : (∃ j, castSucc j = i) ↔ i ≠ last n",
"start": [
429,
1
],
"end": [
431,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_castSucc",
"code": "theorem succ_castSucc {n : Nat} (i : Fin n) : i.castSucc.succ = castSucc i.succ",
"start": [
433,
1
],
"end": [
433,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_addNat",
"code": "@[simp] theorem coe_addNat (m : Nat) (i : Fin n) : (addNat i m : Nat) = i + m",
"start": [
435,
1
],
"end": [
435,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addNat_one",
"code": "@[simp] theorem addNat_one {i : Fin n} : addNat i 1 = i.succ",
"start": [
437,
1
],
"end": [
437,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_coe_addNat",
"code": "theorem le_coe_addNat (m : Nat) (i : Fin n) : m ≤ addNat i m",
"start": [
439,
1
],
"end": [
440,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addNat_mk",
"code": "@[simp] theorem addNat_mk (n i : Nat) (hi : i < m) :\n addNat ⟨i, hi⟩ n = ⟨i + n, Nat.add_lt_add_right hi n⟩",
"start": [
442,
1
],
"end": [
443,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_addNat_zero",
"code": "@[simp] theorem cast_addNat_zero {n n' : Nat} (i : Fin n) (h : n + 0 = n') :\n cast h (addNat i 0) = cast ((Nat.add_zero _).symm.trans h) i",
"start": [
445,
1
],
"end": [
446,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addNat_cast",
"code": "theorem addNat_cast {n n' m : Nat} (i : Fin n') (h : n' = n) :\n addNat (cast h i) m = cast (congrArg (. + m) h) (addNat i m)",
"start": [
448,
1
],
"end": [
450,
72
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_addNat_left",
"code": "theorem cast_addNat_left {n n' m : Nat} (i : Fin n') (h : n' + m = n + m) :\n cast h (addNat i m) = addNat (cast (Nat.add_right_cancel h) i) m",
"start": [
452,
1
],
"end": [
453,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_addNat_right",
"code": "@[simp] theorem cast_addNat_right {n m m' : Nat} (i : Fin n) (h : n + m' = n + m) :\n cast h (addNat i m') = addNat i m",
"start": [
455,
1
],
"end": [
457,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_natAdd",
"code": "@[simp] theorem coe_natAdd (n : Nat) {m : Nat} (i : Fin m) : (natAdd n i : Nat) = n + i",
"start": [
459,
1
],
"end": [
459,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_mk",
"code": "@[simp] theorem natAdd_mk (n i : Nat) (hi : i < m) :\n natAdd n ⟨i, hi⟩ = ⟨n + i, Nat.add_lt_add_left hi n⟩",
"start": [
461,
1
],
"end": [
462,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.le_coe_natAdd",
"code": "theorem le_coe_natAdd (m : Nat) (i : Fin n) : m ≤ natAdd m i",
"start": [
464,
1
],
"end": [
464,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_zero",
"code": "theorem natAdd_zero {n : Nat} : natAdd 0 = cast (Nat.zero_add n).symm",
"start": [
466,
1
],
"end": [
466,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_cast",
"code": "theorem natAdd_cast {n n' : Nat} (m : Nat) (i : Fin n') (h : n' = n) :\n natAdd m (cast h i) = cast (congrArg _ h) (natAdd m i)",
"start": [
468,
1
],
"end": [
470,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_natAdd_right",
"code": "theorem cast_natAdd_right {n n' m : Nat} (i : Fin n') (h : m + n' = m + n) :\n cast h (natAdd m i) = natAdd m (cast (Nat.add_left_cancel h) i)",
"start": [
472,
1
],
"end": [
473,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_natAdd_left",
"code": "@[simp] theorem cast_natAdd_left {n m m' : Nat} (i : Fin n) (h : m' + n = m + n) :\n cast h (natAdd m' i) = natAdd m i",
"start": [
475,
1
],
"end": [
477,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.castAdd_natAdd",
"code": "theorem castAdd_natAdd (p m : Nat) {n : Nat} (i : Fin n) :\n castAdd p (natAdd m i) = cast (Nat.add_assoc ..).symm (natAdd m (castAdd p i))",
"start": [
479,
1
],
"end": [
480,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_castAdd",
"code": "theorem natAdd_castAdd (p m : Nat) {n : Nat} (i : Fin n) :\n natAdd m (castAdd p i) = cast (Nat.add_assoc ..) (castAdd p (natAdd m i))",
"start": [
482,
1
],
"end": [
483,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_natAdd",
"code": "theorem natAdd_natAdd (m n : Nat) {p : Nat} (i : Fin p) :\n natAdd m (natAdd n i) = cast (Nat.add_assoc ..) (natAdd (m + n) i)",
"start": [
485,
1
],
"end": [
487,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_natAdd_zero",
"code": "@[simp]\ntheorem cast_natAdd_zero {n n' : Nat} (i : Fin n) (h : 0 + n = n') :\n cast h (natAdd 0 i) = cast ((Nat.zero_add _).symm.trans h) i",
"start": [
489,
1
],
"end": [
492,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_natAdd",
"code": "@[simp]\ntheorem cast_natAdd (n : Nat) {m : Nat} (i : Fin m) :\n cast (Nat.add_comm ..) (natAdd n i) = addNat i n",
"start": [
494,
1
],
"end": [
496,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cast_addNat",
"code": "@[simp]\ntheorem cast_addNat {n : Nat} (m : Nat) (i : Fin n) :\n cast (Nat.add_comm ..) (addNat i m) = natAdd m i",
"start": [
498,
1
],
"end": [
500,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_last",
"code": "@[simp] theorem natAdd_last {m n : Nat} : natAdd n (last m) = last (n + m)",
"start": [
502,
1
],
"end": [
502,
82
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_castSucc",
"code": "theorem natAdd_castSucc {m n : Nat} {i : Fin m} : natAdd n (castSucc i) = castSucc (natAdd n i)",
"start": [
504,
1
],
"end": [
505,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_castAdd",
"code": "theorem rev_castAdd (k : Fin n) (m : Nat) : rev (castAdd m k) = addNat (rev k) m",
"start": [
507,
1
],
"end": [
508,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_addNat",
"code": "theorem rev_addNat (k : Fin n) (m : Nat) : rev (addNat k m) = castAdd m (rev k)",
"start": [
510,
1
],
"end": [
511,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_castSucc",
"code": "theorem rev_castSucc (k : Fin n) : rev (castSucc k) = succ (rev k)",
"start": [
513,
1
],
"end": [
513,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.rev_succ",
"code": "theorem rev_succ (k : Fin n) : rev (succ k) = castSucc (rev k)",
"start": [
515,
1
],
"end": [
515,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_pred",
"code": "@[simp] theorem coe_pred (j : Fin (n + 1)) (h : j ≠ 0) : (j.pred h : Nat) = j - 1",
"start": [
519,
1
],
"end": [
519,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succ_pred",
"code": "@[simp] theorem succ_pred : ∀ (i : Fin (n + 1)) (h : i ≠ 0), (i.pred h).succ = i",
"start": [
521,
1
],
"end": [
523,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_succ",
"code": "@[simp]\ntheorem pred_succ (i : Fin n) {h : i.succ ≠ 0} : i.succ.pred h = i",
"start": [
525,
1
],
"end": [
528,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_eq_iff_eq_succ",
"code": "theorem pred_eq_iff_eq_succ {n : Nat} (i : Fin (n + 1)) (hi : i ≠ 0) (j : Fin n) :\n i.pred hi = j ↔ i = j.succ",
"start": [
530,
1
],
"end": [
532,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_mk_succ",
"code": "theorem pred_mk_succ (i : Nat) (h : i < n + 1) :\n Fin.pred ⟨i + 1, Nat.add_lt_add_right h 1⟩ (ne_of_val_ne (Nat.ne_of_gt (mk_succ_pos i h))) =\n ⟨i, h⟩",
"start": [
534,
1
],
"end": [
537,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_mk_succ'",
"code": "@[simp] theorem pred_mk_succ' (i : Nat) (h₁ : i + 1 < n + 1 + 1) (h₂) :\n Fin.pred ⟨i + 1, h₁⟩ h₂ = ⟨i, Nat.lt_of_succ_lt_succ h₁⟩",
"start": [
539,
1
],
"end": [
540,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_mk",
"code": "theorem pred_mk {n : Nat} (i : Nat) (h : i < n + 1) (w) : Fin.pred ⟨i, h⟩ w =\n ⟨i - 1, Nat.sub_lt_right_of_lt_add (Nat.pos_iff_ne_zero.2 (Fin.val_ne_of_ne w)) h⟩",
"start": [
543,
1
],
"end": [
545,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_le_pred_iff",
"code": "@[simp] theorem pred_le_pred_iff {n : Nat} {a b : Fin n.succ} {ha : a ≠ 0} {hb : b ≠ 0} :\n a.pred ha ≤ b.pred hb ↔ a ≤ b",
"start": [
547,
1
],
"end": [
548,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_lt_pred_iff",
"code": "@[simp] theorem pred_lt_pred_iff {n : Nat} {a b : Fin n.succ} {ha : a ≠ 0} {hb : b ≠ 0} :\n a.pred ha < b.pred hb ↔ a < b",
"start": [
550,
1
],
"end": [
551,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_inj",
"code": "@[simp] theorem pred_inj :\n ∀ {a b : Fin (n + 1)} {ha : a ≠ 0} {hb : b ≠ 0}, a.pred ha = b.pred hb ↔ a = b",
"start": [
553,
1
],
"end": [
557,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_one",
"code": "@[simp] theorem pred_one {n : Nat} :\n Fin.pred (1 : Fin (n + 2)) (Ne.symm (Fin.ne_of_lt one_pos)) = 0",
"start": [
559,
1
],
"end": [
560,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_add_one",
"code": "theorem pred_add_one (i : Fin (n + 2)) (h : (i : Nat) < n + 1) :\n pred (i + 1) (Fin.ne_of_gt (add_one_pos _ (lt_def.2 h))) = castLT i h",
"start": [
562,
1
],
"end": [
565,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_subNat",
"code": "@[simp] theorem coe_subNat (i : Fin (n + m)) (h : m ≤ i) : (i.subNat m h : Nat) = i - m",
"start": [
567,
1
],
"end": [
567,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subNat_mk",
"code": "@[simp] theorem subNat_mk {i : Nat} (h₁ : i < n + m) (h₂ : m ≤ i) :\n subNat m ⟨i, h₁⟩ h₂ = ⟨i - m, Nat.sub_lt_right_of_lt_add h₂ h₁⟩",
"start": [
569,
1
],
"end": [
570,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.pred_castSucc_succ",
"code": "@[simp] theorem pred_castSucc_succ (i : Fin n) :\n pred (castSucc i.succ) (Fin.ne_of_gt (castSucc_pos i.succ_pos)) = castSucc i",
"start": [
572,
1
],
"end": [
573,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addNat_subNat",
"code": "@[simp] theorem addNat_subNat {i : Fin (n + m)} (h : m ≤ i) : addNat (subNat m i h) m = i",
"start": [
575,
1
],
"end": [
576,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.subNat_addNat",
"code": "@[simp] theorem subNat_addNat (i : Fin n) (m : Nat) (h : m ≤ addNat i m := le_coe_addNat m i) :\n subNat m (addNat i m) h = i",
"start": [
578,
1
],
"end": [
579,
65
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.natAdd_subNat_cast",
"code": "@[simp] theorem natAdd_subNat_cast {i : Fin (n + m)} (h : n ≤ i) :\n natAdd n (subNat n (cast (Nat.add_comm ..) i) h) = i",
"start": [
581,
1
],
"end": [
582,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succRec",
"code": "@[elab_as_elim] def succRec {motive : ∀ n, Fin n → Sort _}\n (zero : ∀ n, motive n.succ (0 : Fin (n + 1)))\n (succ : ∀ n i, motive n i → motive n.succ i.succ) : ∀ {n : Nat} (i : Fin n), motive n i\n | 0, i => i.elim0\n | Nat.succ n, ⟨0, _⟩ => by rw [mk_zero]; exact zero n\n | Nat.succ _, ⟨Nat.succ i, h⟩ => succ _ _ (succRec zero succ ⟨i, Nat.lt_of_succ_lt_succ h⟩)",
"start": [
586,
1
],
"end": [
596,
94
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succRecOn",
"code": "@[elab_as_elim] def succRecOn {n : Nat} (i : Fin n) {motive : ∀ n, Fin n → Sort _}\n (zero : ∀ n, motive (n + 1) 0) (succ : ∀ n i, motive n i → motive (Nat.succ n) i.succ) :\n motive n i := i.succRec zero succ",
"start": [
598,
1
],
"end": [
608,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succRecOn_zero",
"code": "@[simp] theorem succRecOn_zero {motive : ∀ n, Fin n → Sort _} {zero succ} (n) :\n @Fin.succRecOn (n + 1) 0 motive zero succ = zero n",
"start": [
610,
1
],
"end": [
612,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.succRecOn_succ",
"code": "@[simp] theorem succRecOn_succ {motive : ∀ n, Fin n → Sort _} {zero succ} {n} (i : Fin n) :\n @Fin.succRecOn (n + 1) i.succ motive zero succ = succ n i (Fin.succRecOn i zero succ)",
"start": [
614,
1
],
"end": [
616,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.induction",
"code": "@[elab_as_elim] def induction {motive : Fin (n + 1) → Sort _} (zero : motive 0)\n (succ : ∀ i : Fin n, motive (castSucc i) → motive i.succ) :\n ∀ i : Fin (n + 1), motive i\n | ⟨i, hi⟩ => go i hi\nwhere\n go : ∀ (i : Nat) (hi : i < n + 1), motive ⟨i, hi⟩\n | 0, hi => by rwa [Fin.mk_zero]\n | i+1, hi => succ ⟨i, Nat.lt_of_succ_lt_succ hi⟩ (go i (Nat.lt_of_succ_lt hi))",
"start": [
619,
1
],
"end": [
632,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.induction_zero",
"code": "@[simp] theorem induction_zero {motive : Fin (n + 1) → Sort _} (zero : motive 0)\n (hs : ∀ i : Fin n, motive (castSucc i) → motive i.succ) :\n (induction zero hs : ∀ i : Fin (n + 1), motive i) 0 = zero",
"start": [
634,
1
],
"end": [
636,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.induction_succ",
"code": "@[simp] theorem induction_succ {motive : Fin (n + 1) → Sort _} (zero : motive 0)\n (succ : ∀ i : Fin n, motive (castSucc i) → motive i.succ) (i : Fin n) :\n induction (motive := motive) zero succ i.succ = succ i (induction zero succ (castSucc i))",
"start": [
638,
1
],
"end": [
640,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.inductionOn",
"code": "@[elab_as_elim] def inductionOn (i : Fin (n + 1)) {motive : Fin (n + 1) → Sort _} (zero : motive 0)\n (succ : ∀ i : Fin n, motive (castSucc i) → motive i.succ) : motive i := induction zero succ i",
"start": [
642,
1
],
"end": [
650,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cases",
"code": "@[elab_as_elim] def cases {motive : Fin (n + 1) → Sort _}\n (zero : motive 0) (succ : ∀ i : Fin n, motive i.succ) :\n ∀ i : Fin (n + 1), motive i := induction zero fun i _ => succ i",
"start": [
652,
1
],
"end": [
656,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cases_zero",
"code": "@[simp] theorem cases_zero {n} {motive : Fin (n + 1) → Sort _} {zero succ} :\n @Fin.cases n motive zero succ 0 = zero",
"start": [
658,
1
],
"end": [
659,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cases_succ",
"code": "@[simp] theorem cases_succ {n} {motive : Fin (n + 1) → Sort _} {zero succ} (i : Fin n) :\n @Fin.cases n motive zero succ i.succ = succ i",
"start": [
661,
1
],
"end": [
662,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.cases_succ'",
"code": "@[simp] theorem cases_succ' {n} {motive : Fin (n + 1) → Sort _} {zero succ}\n {i : Nat} (h : i + 1 < n + 1) :\n @Fin.cases n motive zero succ ⟨i.succ, h⟩ = succ ⟨i, Nat.lt_of_succ_lt_succ h⟩",
"start": [
664,
1
],
"end": [
666,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.forall_fin_succ",
"code": "theorem forall_fin_succ {P : Fin (n + 1) → Prop} : (∀ i, P i) ↔ P 0 ∧ ∀ i : Fin n, P i.succ",
"start": [
668,
1
],
"end": [
669,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.exists_fin_succ",
"code": "theorem exists_fin_succ {P : Fin (n + 1) → Prop} : (∃ i, P i) ↔ P 0 ∨ ∃ i : Fin n, P i.succ",
"start": [
671,
1
],
"end": [
673,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.forall_fin_one",
"code": "theorem forall_fin_one {p : Fin 1 → Prop} : (∀ i, p i) ↔ p 0",
"start": [
675,
1
],
"end": [
676,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.exists_fin_one",
"code": "theorem exists_fin_one {p : Fin 1 → Prop} : (∃ i, p i) ↔ p 0",
"start": [
678,
1
],
"end": [
679,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.forall_fin_two",
"code": "theorem forall_fin_two {p : Fin 2 → Prop} : (∀ i, p i) ↔ p 0 ∧ p 1",
"start": [
681,
1
],
"end": [
682,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.exists_fin_two",
"code": "theorem exists_fin_two {p : Fin 2 → Prop} : (∃ i, p i) ↔ p 0 ∨ p 1",
"start": [
684,
1
],
"end": [
685,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.fin_two_eq_of_eq_zero_iff",
"code": "theorem fin_two_eq_of_eq_zero_iff : ∀ {a b : Fin 2}, (a = 0 ↔ b = 0) → a = b",
"start": [
687,
1
],
"end": [
688,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.reverseInduction",
"code": "@[elab_as_elim] def reverseInduction {motive : Fin (n + 1) → Sort _} (last : motive (Fin.last n))\n (cast : ∀ i : Fin n, motive i.succ → motive (castSucc i)) (i : Fin (n + 1)) : motive i :=\n if hi : i = Fin.last n then _root_.cast (congrArg motive hi.symm) last\n else\n let j : Fin n := ⟨i, Nat.lt_of_le_of_ne (Nat.le_of_lt_succ i.2) fun h => hi (Fin.ext h)⟩\n cast _ (reverseInduction last cast j.succ)\ntermination_by n + 1 - i\ndecreasing_by decreasing_with\n try simp only [Nat.succ_sub_succ_eq_sub]\n exact Nat.add_sub_add_right .. ▸ Nat.sub_lt_sub_left i.2 (Nat.lt_succ_self i)",
"start": [
690,
1
],
"end": [
705,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.reverseInduction_last",
"code": "@[simp] theorem reverseInduction_last {n : Nat} {motive : Fin (n + 1) → Sort _} {zero succ} :\n (reverseInduction zero succ (Fin.last n) : motive (Fin.last n)) = zero",
"start": [
707,
1
],
"end": [
709,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.reverseInduction_castSucc",
"code": "@[simp] theorem reverseInduction_castSucc {n : Nat} {motive : Fin (n + 1) → Sort _} {zero succ}\n (i : Fin n) : reverseInduction (motive := motive) zero succ (castSucc i) =\n succ i (reverseInduction zero succ i.succ)",
"start": [
711,
1
],
"end": [
714,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lastCases",
"code": "@[elab_as_elim] def lastCases {n : Nat} {motive : Fin (n + 1) → Sort _} (last : motive (Fin.last n))\n (cast : ∀ i : Fin n, motive (castSucc i)) (i : Fin (n + 1)) : motive i :=\n reverseInduction last (fun i _ => cast i) i",
"start": [
716,
1
],
"end": [
720,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lastCases_last",
"code": "@[simp] theorem lastCases_last {n : Nat} {motive : Fin (n + 1) → Sort _} {last cast} :\n (Fin.lastCases last cast (Fin.last n) : motive (Fin.last n)) = last",
"start": [
722,
1
],
"end": [
724,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.lastCases_castSucc",
"code": "@[simp] theorem lastCases_castSucc {n : Nat} {motive : Fin (n + 1) → Sort _} {last cast}\n (i : Fin n) : (Fin.lastCases last cast (Fin.castSucc i) : motive (Fin.castSucc i)) = cast i",
"start": [
726,
1
],
"end": [
728,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addCases",
"code": "@[elab_as_elim] def addCases {m n : Nat} {motive : Fin (m + n) → Sort u}\n (left : ∀ i, motive (castAdd n i)) (right : ∀ i, motive (natAdd m i))\n (i : Fin (m + n)) : motive i :=\n if hi : (i : Nat) < m then (castAdd_castLT n i hi) ▸ (left (castLT i hi))\n else (natAdd_subNat_cast (Nat.le_of_not_lt hi)) ▸ (right _)",
"start": [
730,
1
],
"end": [
736,
62
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addCases_left",
"code": "@[simp] theorem addCases_left {m n : Nat} {motive : Fin (m + n) → Sort _} {left right} (i : Fin m) :\n addCases (motive := motive) left right (Fin.castAdd n i) = left i",
"start": [
738,
1
],
"end": [
740,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.addCases_right",
"code": "@[simp]\ntheorem addCases_right {m n : Nat} {motive : Fin (m + n) → Sort _} {left right} (i : Fin n) :\n addCases (motive := motive) left right (natAdd m i) = right i",
"start": [
742,
1
],
"end": [
746,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ofNat'_add",
"code": "@[simp] theorem ofNat'_add (x : Nat) (lt : 0 < n) (y : Fin n) :\n Fin.ofNat' x lt + y = Fin.ofNat' (x + y.val) lt",
"start": [
750,
1
],
"end": [
753,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.add_ofNat'",
"code": "@[simp] theorem add_ofNat' (x : Fin n) (y : Nat) (lt : 0 < n) :\n x + Fin.ofNat' y lt = Fin.ofNat' (x.val + y) lt",
"start": [
755,
1
],
"end": [
758,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_sub",
"code": "protected theorem coe_sub (a b : Fin n) : ((a - b : Fin n) : Nat) = ((n - b) + a) % n",
"start": [
762,
1
],
"end": [
763,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.ofNat'_sub",
"code": "@[simp] theorem ofNat'_sub (x : Nat) (lt : 0 < n) (y : Fin n) :\n Fin.ofNat' x lt - y = Fin.ofNat' ((n - y.val) + x) lt",
"start": [
765,
1
],
"end": [
768,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.sub_ofNat'",
"code": "@[simp] theorem sub_ofNat' (x : Fin n) (y : Nat) (lt : 0 < n) :\n x - Fin.ofNat' y lt = Fin.ofNat' ((n - y % n) + x.val) lt",
"start": [
770,
1
],
"end": [
773,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Nat.mod_eq_sub_of_lt_two_mul",
"code": "private theorem _root_.Nat.mod_eq_sub_of_lt_two_mul {x n} (h₁ : n ≤ x) (h₂ : x < 2 * n) :\n x % n = x - n",
"start": [
775,
1
],
"end": [
777,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_sub_iff_le",
"code": "theorem coe_sub_iff_le {a b : Fin n} : (↑(a - b) : Nat) = a - b ↔ b ≤ a",
"start": [
779,
1
],
"end": [
787,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_sub_iff_lt",
"code": "theorem coe_sub_iff_lt {a b : Fin n} : (↑(a - b) : Nat) = n + a - b ↔ a < b",
"start": [
789,
1
],
"end": [
797,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.val_mul",
"code": "theorem val_mul {n : Nat} : ∀ a b : Fin n, (a * b).val = a.val * b.val % n",
"start": [
801,
1
],
"end": [
802,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.coe_mul",
"code": "theorem coe_mul {n : Nat} : ∀ a b : Fin n, ((a * b : Fin n) : Nat) = a * b % n",
"start": [
804,
1
],
"end": [
805,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul_one",
"code": "protected theorem mul_one (k : Fin (n + 1)) : k * 1 = k",
"start": [
807,
1
],
"end": [
810,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul_comm",
"code": "protected theorem mul_comm (a b : Fin n) : a * b = b * a",
"start": [
812,
1
],
"end": [
813,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul_assoc",
"code": "protected theorem mul_assoc (a b c : Fin n) : a * b * c = a * (b * c)",
"start": [
816,
1
],
"end": [
820,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.one_mul",
"code": "protected theorem one_mul (k : Fin (n + 1)) : (1 : Fin (n + 1)) * k = k",
"start": [
823,
1
],
"end": [
824,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.mul_zero",
"code": "protected theorem mul_zero (k : Fin (n + 1)) : k * 0 = 0",
"start": [
829,
1
],
"end": [
829,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Fin.zero_mul",
"code": "protected theorem zero_mul (k : Fin (n + 1)) : (0 : Fin (n + 1)) * k = 0",
"start": [
831,
1
],
"end": [
832,
26
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/ByteArray/Basic.lean | [
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Array/Subarray.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Option/Basic.lean"
] | [
{
"full_name": "ByteArray",
"code": "structure ByteArray where\n data : Array UInt8",
"start": [
13,
1
],
"end": [
14,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.mkEmpty",
"code": "@[extern \"lean_mk_empty_byte_array\"]\ndef mkEmpty (c : @& Nat) : ByteArray :=\n { data := #[] }",
"start": [
20,
1
],
"end": [
22,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.empty",
"code": "def empty : ByteArray := mkEmpty 0",
"start": [
24,
1
],
"end": [
24,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.push",
"code": "@[extern \"lean_byte_array_push\"]\ndef push : ByteArray → UInt8 → ByteArray\n | ⟨bs⟩, b => ⟨bs.push b⟩",
"start": [
32,
1
],
"end": [
34,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.size",
"code": "@[extern \"lean_byte_array_size\"]\ndef size : (@& ByteArray) → Nat\n | ⟨bs⟩ => bs.size",
"start": [
36,
1
],
"end": [
38,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.uget",
"code": "@[extern \"lean_byte_array_uget\"]\ndef uget : (a : @& ByteArray) → (i : USize) → i.toNat < a.size → UInt8\n | ⟨bs⟩, i, h => bs[i]",
"start": [
40,
1
],
"end": [
42,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.get!",
"code": "@[extern \"lean_byte_array_get\"]\ndef get! : (@& ByteArray) → (@& Nat) → UInt8\n | ⟨bs⟩, i => bs.get! i",
"start": [
44,
1
],
"end": [
46,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.get",
"code": "@[extern \"lean_byte_array_fget\"]\ndef get : (a : @& ByteArray) → (@& Fin a.size) → UInt8\n | ⟨bs⟩, i => bs.get i",
"start": [
48,
1
],
"end": [
50,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.set!",
"code": "@[extern \"lean_byte_array_set\"]\ndef set! : ByteArray → (@& Nat) → UInt8 → ByteArray\n | ⟨bs⟩, i, b => ⟨bs.set! i b⟩",
"start": [
58,
1
],
"end": [
60,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.set",
"code": "@[extern \"lean_byte_array_fset\"]\ndef set : (a : ByteArray) → (@& Fin a.size) → UInt8 → ByteArray\n | ⟨bs⟩, i, b => ⟨bs.set i b⟩",
"start": [
62,
1
],
"end": [
64,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.uset",
"code": "@[extern \"lean_byte_array_uset\"]\ndef uset : (a : ByteArray) → (i : USize) → UInt8 → i.toNat < a.size → ByteArray\n | ⟨bs⟩, i, v, h => ⟨bs.uset i v h⟩",
"start": [
66,
1
],
"end": [
68,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.hash",
"code": "@[extern \"lean_byte_array_hash\"]\nprotected opaque hash (a : @& ByteArray) : UInt64",
"start": [
70,
1
],
"end": [
71,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.isEmpty",
"code": "def isEmpty (s : ByteArray) : Bool :=\n s.size == 0",
"start": [
76,
1
],
"end": [
77,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.copySlice",
"code": "@[extern \"lean_byte_array_copy_slice\"]\ndef copySlice (src : @& ByteArray) (srcOff : Nat) (dest : ByteArray) (destOff len : Nat) (exact : Bool := true) : ByteArray :=\n ⟨dest.data.extract 0 destOff ++ src.data.extract srcOff (srcOff + len) ++ dest.data.extract (destOff + min len (src.data.size - srcOff)) dest.data.size⟩",
"start": [
79,
1
],
"end": [
84,
155
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.extract",
"code": "def extract (a : ByteArray) (b e : Nat) : ByteArray :=\n a.copySlice b empty 0 (e - b)",
"start": [
86,
1
],
"end": [
87,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.append",
"code": "protected def append (a : ByteArray) (b : ByteArray) : ByteArray :=\n b.copySlice 0 a a.size b.size false",
"start": [
89,
1
],
"end": [
91,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.toList",
"code": "partial def toList (bs : ByteArray) : List UInt8 :=\n let rec loop (i : Nat) (r : List UInt8) :=\n if i < bs.size then\n loop (i+1) (bs.get! i :: r)\n else\n r.reverse\n loop 0 []",
"start": [
95,
1
],
"end": [
101,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.findIdx?",
"code": "@[inline] partial def findIdx? (a : ByteArray) (p : UInt8 → Bool) (start := 0) : Option Nat :=\n let rec @[specialize] loop (i : Nat) :=\n if i < a.size then\n if p (a.get! i) then some i else loop (i+1)\n else\n none\n loop start",
"start": [
103,
1
],
"end": [
109,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.forInUnsafe",
"code": "@[inline] unsafe def forInUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (b : β) (f : UInt8 → β → m (ForInStep β)) : m β :=\n let sz := USize.ofNat as.size\n let rec @[specialize] loop (i : USize) (b : β) : m β := do\n if i < sz then\n let a := as.uget i lcProof\n match (← f a b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop (i+1) b\n else\n pure b\n loop 0 b",
"start": [
111,
1
],
"end": [
127,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.forIn",
"code": "@[implemented_by ByteArray.forInUnsafe]\nprotected def forIn {β : Type v} {m : Type v → Type w} [Monad m] (as : ByteArray) (b : β) (f : UInt8 → β → m (ForInStep β)) : m β :=\n let rec loop (i : Nat) (h : i ≤ as.size) (b : β) : m β := do\n match i, h with\n | 0, _ => pure b\n | i+1, h =>\n have h' : i < as.size := Nat.lt_of_lt_of_le (Nat.lt_succ_self i) h\n have : as.size - 1 < as.size := Nat.sub_lt (Nat.zero_lt_of_lt h') (by decide)\n have : as.size - 1 - i < as.size := Nat.lt_of_le_of_lt (Nat.sub_le (as.size - 1) i) this\n match (← f (as.get ⟨as.size - 1 - i, this⟩) b) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => loop i (Nat.le_of_lt h') b\n loop as.size (Nat.le_refl _) b",
"start": [
129,
1
],
"end": [
142,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.foldlMUnsafe",
"code": "@[inline]\nunsafe def foldlMUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (f : β → UInt8 → m β) (init : β) (as : ByteArray) (start := 0) (stop := as.size) : m β :=\n let rec @[specialize] fold (i : USize) (stop : USize) (b : β) : m β := do\n if i == stop then\n pure b\n else\n fold (i+1) stop (← f b (as.uget i lcProof))\n if start < stop then\n if stop ≤ as.size then\n fold (USize.ofNat start) (USize.ofNat stop) init\n else\n pure init\n else\n pure init",
"start": [
147,
1
],
"end": [
162,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.foldlM",
"code": "@[implemented_by foldlMUnsafe]\ndef foldlM {β : Type v} {m : Type v → Type w} [Monad m] (f : β → UInt8 → m β) (init : β) (as : ByteArray) (start := 0) (stop := as.size) : m β :=\n let fold (stop : Nat) (h : stop ≤ as.size) :=\n let rec loop (i : Nat) (j : Nat) (b : β) : m β := do\n if hlt : j < stop then\n match i with\n | 0 => pure b\n | i'+1 =>\n loop i' (j+1) (← f b (as.get ⟨j, Nat.lt_of_lt_of_le hlt h⟩))\n else\n pure b\n loop (stop - start) start init\n if h : stop ≤ as.size then\n fold stop h\n else\n fold as.size (Nat.le_refl _)",
"start": [
164,
1
],
"end": [
180,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.foldl",
"code": "@[inline]\ndef foldl {β : Type v} (f : β → UInt8 → β) (init : β) (as : ByteArray) (start := 0) (stop := as.size) : β :=\n Id.run <| as.foldlM f init start stop",
"start": [
182,
1
],
"end": [
184,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toByteArray",
"code": "def List.toByteArray (bs : List UInt8) : ByteArray :=\n let rec loop\n | [], r => r\n | b::bs, r => loop bs (r.push b)\n loop bs ByteArray.empty",
"start": [
188,
1
],
"end": [
192,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.toUInt64LE!",
"code": "def ByteArray.toUInt64LE! (bs : ByteArray) : UInt64 :=\n assert! bs.size == 8\n (bs.get! 7).toUInt64 <<< 0x38 |||\n (bs.get! 6).toUInt64 <<< 0x30 |||\n (bs.get! 5).toUInt64 <<< 0x28 |||\n (bs.get! 4).toUInt64 <<< 0x20 |||\n (bs.get! 3).toUInt64 <<< 0x18 |||\n (bs.get! 2).toUInt64 <<< 0x10 |||\n (bs.get! 1).toUInt64 <<< 0x8 |||\n (bs.get! 0).toUInt64",
"start": [
196,
1
],
"end": [
206,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "ByteArray.toUInt64BE!",
"code": "def ByteArray.toUInt64BE! (bs : ByteArray) : UInt64 :=\n assert! bs.size == 8\n (bs.get! 0).toUInt64 <<< 0x38 |||\n (bs.get! 1).toUInt64 <<< 0x30 |||\n (bs.get! 2).toUInt64 <<< 0x28 |||\n (bs.get! 3).toUInt64 <<< 0x20 |||\n (bs.get! 4).toUInt64 <<< 0x18 |||\n (bs.get! 5).toUInt64 <<< 0x10 |||\n (bs.get! 6).toUInt64 <<< 0x8 |||\n (bs.get! 7).toUInt64",
"start": [
208,
1
],
"end": [
218,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/UInt/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Fin/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean"
] | [
{
"full_name": "zero_def",
"code": "theorem zero_def : (0 : $typeName) = ⟨0⟩",
"start": [
18,
1
],
"end": [
18,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "one_def",
"code": "theorem one_def : (1 : $typeName) = ⟨1⟩",
"start": [
19,
1
],
"end": [
19,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "sub_def",
"code": "theorem sub_def (a b : $typeName) : a - b = ⟨a.val - b.val⟩",
"start": [
20,
1
],
"end": [
20,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "mul_def",
"code": "theorem mul_def (a b : $typeName) : a * b = ⟨a.val * b.val⟩",
"start": [
21,
1
],
"end": [
21,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "mod_def",
"code": "theorem mod_def (a b : $typeName) : a % b = ⟨a.val % b.val⟩",
"start": [
22,
1
],
"end": [
22,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "add_def",
"code": "theorem add_def (a b : $typeName) : a + b = ⟨a.val + b.val⟩",
"start": [
23,
1
],
"end": [
23,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "mk_val_eq",
"code": "@[simp] theorem mk_val_eq : ∀ (a : $typeName), mk a.val = a",
"start": [
25,
1
],
"end": [
26,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "val_eq_of_lt",
"code": "theorem val_eq_of_lt {a : Nat} : a < size → ((ofNat a).val : Nat) = a",
"start": [
27,
1
],
"end": [
28,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "le_def",
"code": "theorem le_def {a b : $typeName} : a ≤ b ↔ a.1 ≤ b.1",
"start": [
30,
1
],
"end": [
30,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_def",
"code": "theorem lt_def {a b : $typeName} : a < b ↔ a.1 < b.1",
"start": [
31,
1
],
"end": [
31,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_iff_val_lt_val",
"code": "theorem lt_iff_val_lt_val {a b : $typeName} : a < b ↔ a.val < b.val",
"start": [
32,
1
],
"end": [
32,
76
],
"kind": "commanddeclaration"
},
{
"full_name": "not_le",
"code": "@[simp] protected theorem not_le {a b : $typeName} : ¬ a ≤ b ↔ b < a",
"start": [
33,
1
],
"end": [
33,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "not_lt",
"code": "@[simp] protected theorem not_lt {a b : $typeName} : ¬ a < b ↔ b ≤ a",
"start": [
34,
1
],
"end": [
34,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "le_refl",
"code": "@[simp] protected theorem le_refl (a : $typeName) : a ≤ a",
"start": [
35,
1
],
"end": [
35,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl (a : $typeName) : ¬ a < a",
"start": [
36,
1
],
"end": [
36,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "le_trans",
"code": "protected theorem le_trans {a b c : $typeName} : a ≤ b → b ≤ c → a ≤ c",
"start": [
37,
1
],
"end": [
37,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_trans",
"code": "protected theorem lt_trans {a b c : $typeName} : a < b → b < c → a < c",
"start": [
38,
1
],
"end": [
38,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "le_total",
"code": "protected theorem le_total (a b : $typeName) : a ≤ b ∨ b ≤ a",
"start": [
39,
1
],
"end": [
39,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "lt_asymm",
"code": "protected theorem lt_asymm {a b : $typeName} (h : a < b) : ¬ b < a",
"start": [
40,
1
],
"end": [
40,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "val_eq_of_eq",
"code": "protected theorem val_eq_of_eq {a b : $typeName} (h : a = b) : a.val = b.val",
"start": [
41,
1
],
"end": [
41,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "eq_of_val_eq",
"code": "protected theorem eq_of_val_eq {a b : $typeName} (h : a.val = b.val) : a = b",
"start": [
42,
1
],
"end": [
42,
121
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_of_val_ne",
"code": "protected theorem ne_of_val_ne {a b : $typeName} (h : a.val ≠ b.val) : a ≠ b",
"start": [
44,
1
],
"end": [
44,
117
],
"kind": "commanddeclaration"
},
{
"full_name": "ne_of_lt",
"code": "protected theorem ne_of_lt {a b : $typeName} (h : a < b) : a ≠ b",
"start": [
46,
1
],
"end": [
46,
98
],
"kind": "commanddeclaration"
},
{
"full_name": "zero_toNat",
"code": "@[simp] protected theorem zero_toNat : (0 : $typeName).toNat = 0",
"start": [
48,
1
],
"end": [
48,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "mod_toNat",
"code": "@[simp] protected theorem mod_toNat (a b : $typeName) : (a % b).toNat = a.toNat % b.toNat",
"start": [
49,
1
],
"end": [
49,
108
],
"kind": "commanddeclaration"
},
{
"full_name": "div_toNat",
"code": "@[simp] protected theorem div_toNat (a b : $typeName) : (a / b).toNat = a.toNat / b.toNat",
"start": [
50,
1
],
"end": [
50,
108
],
"kind": "commanddeclaration"
},
{
"full_name": "modn_toNat",
"code": "@[simp] protected theorem modn_toNat (a : $typeName) (b : Nat) : (a.modn b).toNat = a.toNat % b",
"start": [
51,
1
],
"end": [
51,
115
],
"kind": "commanddeclaration"
},
{
"full_name": "modn_lt",
"code": "protected theorem modn_lt {m : Nat} : ∀ (u : $typeName), m > 0 → toNat (u % m) < m",
"start": [
52,
1
],
"end": [
53,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "mod_lt",
"code": "protected theorem mod_lt (a b : $typeName) (h : 0 < b) : a % b < b",
"start": [
55,
1
],
"end": [
55,
113
],
"kind": "commanddeclaration"
},
{
"full_name": "toNat.inj",
"code": "protected theorem toNat.inj : ∀ {a b : $typeName}, a.toNat = b.toNat → a = b",
"start": [
56,
1
],
"end": [
57,
31
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/ByteArray.lean | [
".lake/packages/lean4/src/lean/Init/Data/ByteArray/Basic.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Char/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Char/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Lemmas.lean"
] | [
{
"full_name": "Char.le_def",
"code": "theorem le_def {a b : Char} : a ≤ b ↔ a.1 ≤ b.1",
"start": [
12,
1
],
"end": [
12,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt_def",
"code": "theorem lt_def {a b : Char} : a < b ↔ a.1 < b.1",
"start": [
13,
1
],
"end": [
13,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt_iff_val_lt_val",
"code": "theorem lt_iff_val_lt_val {a b : Char} : a < b ↔ a.val < b.val",
"start": [
14,
1
],
"end": [
14,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.not_le",
"code": "@[simp] protected theorem not_le {a b : Char} : ¬ a ≤ b ↔ b < a",
"start": [
15,
1
],
"end": [
15,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.not_lt",
"code": "@[simp] protected theorem not_lt {a b : Char} : ¬ a < b ↔ b ≤ a",
"start": [
16,
1
],
"end": [
16,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.le_refl",
"code": "@[simp] protected theorem le_refl (a : Char) : a ≤ a",
"start": [
17,
1
],
"end": [
17,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl (a : Char) : ¬ a < a",
"start": [
18,
1
],
"end": [
18,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.le_trans",
"code": "protected theorem le_trans {a b c : Char} : a ≤ b → b ≤ c → a ≤ c",
"start": [
19,
1
],
"end": [
19,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt_trans",
"code": "protected theorem lt_trans {a b c : Char} : a < b → b < c → a < c",
"start": [
20,
1
],
"end": [
20,
85
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.le_total",
"code": "protected theorem le_total (a b : Char) : a ≤ b ∨ b ≤ a",
"start": [
21,
1
],
"end": [
21,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.lt_asymm",
"code": "protected theorem lt_asymm {a b : Char} (h : a < b) : ¬ b < a",
"start": [
22,
1
],
"end": [
22,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ne_of_lt",
"code": "protected theorem ne_of_lt {a b : Char} (h : a < b) : a ≠ b",
"start": [
23,
1
],
"end": [
23,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.utf8Size_eq",
"code": "theorem utf8Size_eq (c : Char) : c.utf8Size = 1 ∨ c.utf8Size = 2 ∨ c.utf8Size = 3 ∨ c.utf8Size = 4",
"start": [
25,
1
],
"end": [
28,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.ofNat_toNat",
"code": "@[simp] theorem ofNat_toNat (c : Char) : Char.ofNat c.toNat = c",
"start": [
30,
1
],
"end": [
32,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.Char.ext",
"code": "@[ext] theorem Char.ext : {a b : Char} → a.val = b.val → a = b",
"start": [
34,
1
],
"end": [
35,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Char.Char.ext_iff",
"code": "theorem Char.ext_iff {x y : Char} : x = y ↔ x.val = y.val",
"start": [
37,
1
],
"end": [
37,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "String.csize",
"code": "@[deprecated Char.utf8Size (since := \"2024-06-04\")] abbrev String.csize := Char.utf8Size",
"start": [
41,
1
],
"end": [
41,
89
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/String/Extra.lean | [
".lake/packages/lean4/src/lean/Init/Data/ByteArray.lean"
] | [
{
"full_name": "String.toNat!",
"code": "def toNat! (s : String) : Nat :=\n if s.isNat then\n s.foldl (fun n c => n*10 + (c.toNat - '0'.toNat)) 0\n else\n panic! \"Nat expected\"",
"start": [
11,
1
],
"end": [
18,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8DecodeChar?",
"code": "def utf8DecodeChar? (a : ByteArray) (i : Nat) : Option Char := do\n let c ← a[i]?\n if c &&& 0x80 == 0 then\n some ⟨c.toUInt32, .inl (Nat.lt_trans c.1.2 (by decide))⟩\n else if c &&& 0xe0 == 0xc0 then\n let c1 ← a[i+1]?\n guard (c1 &&& 0xc0 == 0x80)\n let r := ((c &&& 0x1f).toUInt32 <<< 6) ||| (c1 &&& 0x3f).toUInt32\n guard (0x80 ≤ r)\n if h : r < 0xd800 then some ⟨r, .inl h⟩ else none\n else if c &&& 0xf0 == 0xe0 then\n let c1 ← a[i+1]?\n let c2 ← a[i+2]?\n guard (c1 &&& 0xc0 == 0x80 && c2 &&& 0xc0 == 0x80)\n let r :=\n ((c &&& 0x0f).toUInt32 <<< 12) |||\n ((c1 &&& 0x3f).toUInt32 <<< 6) |||\n (c2 &&& 0x3f).toUInt32\n guard (0x800 ≤ r)\n if h : r < 0xd800 ∨ 0xdfff < r ∧ r < 0x110000 then some ⟨r, h⟩ else none\n else if c &&& 0xf8 == 0xf0 then\n let c1 ← a[i+1]?\n let c2 ← a[i+2]?\n let c3 ← a[i+3]?\n guard (c1 &&& 0xc0 == 0x80 && c2 &&& 0xc0 == 0x80 && c3 &&& 0xc0 == 0x80)\n let r :=\n ((c &&& 0x07).toUInt32 <<< 18) |||\n ((c1 &&& 0x3f).toUInt32 <<< 12) |||\n ((c2 &&& 0x3f).toUInt32 <<< 6) |||\n (c3 &&& 0x3f).toUInt32\n if h : 0x10000 ≤ r ∧ r < 0x110000 then\n some ⟨r, .inr ⟨Nat.lt_of_lt_of_le (by decide) h.1, h.2⟩⟩\n else none\n else\n none",
"start": [
20,
1
],
"end": [
56,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "String.validateUTF8",
"code": "@[extern \"lean_string_validate_utf8\"]\ndef validateUTF8 (a : @& ByteArray) : Bool :=\n (loop 0).isSome\nwhere\n loop (i : Nat) : Option Unit := do\n if i < a.size then\n let c ← utf8DecodeChar? a i\n loop (i + c.utf8Size)\n else pure ()\n termination_by a.size - i\n decreasing_by exact Nat.sub_lt_sub_left ‹_› (Nat.lt_add_of_pos_right c.utf8Size_pos)",
"start": [
58,
1
],
"end": [
69,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "String.fromUTF8",
"code": "@[extern \"lean_string_from_utf8_unchecked\"]\ndef fromUTF8 (a : @& ByteArray) (h : validateUTF8 a) : String :=\n loop 0 \"\"\nwhere\n loop (i : Nat) (acc : String) : String :=\n if i < a.size then\n let c := (utf8DecodeChar? a i).getD default\n loop (i + c.utf8Size) (acc.push c)\n else acc\n termination_by a.size - i\n decreasing_by exact Nat.sub_lt_sub_left ‹_› (Nat.lt_add_of_pos_right c.utf8Size_pos)",
"start": [
71,
1
],
"end": [
82,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "String.fromUTF8?",
"code": "@[inline] def fromUTF8? (a : ByteArray) : Option String :=\n if h : validateUTF8 a then fromUTF8 a h else none",
"start": [
84,
1
],
"end": [
87,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "String.fromUTF8!",
"code": "@[inline] def fromUTF8! (a : ByteArray) : String :=\n if h : validateUTF8 a then fromUTF8 a h else panic! \"invalid UTF-8 string\"",
"start": [
89,
1
],
"end": [
92,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "String.utf8EncodeChar",
"code": "def utf8EncodeChar (c : Char) : List UInt8 :=\n let v := c.val\n if v ≤ 0x7f then\n [v.toUInt8]\n else if v ≤ 0x7ff then\n [(v >>> 6).toUInt8 &&& 0x1f ||| 0xc0,\n v.toUInt8 &&& 0x3f ||| 0x80]\n else if v ≤ 0xffff then\n [(v >>> 12).toUInt8 &&& 0x0f ||| 0xe0,\n (v >>> 6).toUInt8 &&& 0x3f ||| 0x80,\n v.toUInt8 &&& 0x3f ||| 0x80]\n else\n [(v >>> 18).toUInt8 &&& 0x07 ||| 0xf0,\n (v >>> 12).toUInt8 &&& 0x3f ||| 0x80,\n (v >>> 6).toUInt8 &&& 0x3f ||| 0x80,\n v.toUInt8 &&& 0x3f ||| 0x80]",
"start": [
94,
1
],
"end": [
109,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "String.length_utf8EncodeChar",
"code": "@[simp] theorem length_utf8EncodeChar (c : Char) : (utf8EncodeChar c).length = c.utf8Size",
"start": [
111,
1
],
"end": [
115,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toUTF8",
"code": "@[extern \"lean_string_to_utf8\"]\ndef toUTF8 (a : @& String) : ByteArray :=\n ⟨⟨a.data.bind utf8EncodeChar⟩⟩",
"start": [
117,
1
],
"end": [
120,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "String.size_toUTF8",
"code": "@[simp] theorem size_toUTF8 (s : String) : s.toUTF8.size = s.utf8ByteSize",
"start": [
122,
1
],
"end": [
124,
84
],
"kind": "commanddeclaration"
},
{
"full_name": "String.getUtf8Byte",
"code": "@[extern \"lean_string_get_byte_fast\"]\ndef getUtf8Byte (s : @& String) (n : Nat) (h : n < s.utf8ByteSize) : UInt8 :=\n (toUTF8 s).get ⟨n, size_toUTF8 _ ▸ h⟩",
"start": [
126,
1
],
"end": [
129,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.sizeOf_next_lt_of_hasNext",
"code": "theorem Iterator.sizeOf_next_lt_of_hasNext (i : String.Iterator) (h : i.hasNext) : sizeOf i.next < sizeOf i",
"start": [
131,
1
],
"end": [
133,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.sizeOf_next_lt_of_atEnd",
"code": "theorem Iterator.sizeOf_next_lt_of_atEnd (i : String.Iterator) (h : ¬ i.atEnd = true) : sizeOf i.next < sizeOf i",
"start": [
139,
1
],
"end": [
141,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.find",
"code": "@[specialize] def find (it : Iterator) (p : Char → Bool) : Iterator :=\n if it.atEnd then it\n else if p it.curr then it\n else find it.next p",
"start": [
149,
1
],
"end": [
153,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "String.Iterator.foldUntil",
"code": "@[specialize] def foldUntil (it : Iterator) (init : α) (f : α → Char → Option α) : α × Iterator :=\n if it.atEnd then\n (init, it)\n else if let some a := f init it.curr then\n foldUntil it.next a f\n else\n (init, it)",
"start": [
155,
1
],
"end": [
161,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "String.findLeadingSpacesSize",
"code": "private def findLeadingSpacesSize (s : String) : Nat :=\n let it := s.iter\n let it := it.find (· == '\\n') |>.next\n consumeSpaces it 0 s.length\nwhere\n consumeSpaces (it : String.Iterator) (curr min : Nat) : Nat :=\n if it.atEnd then min\n else if it.curr == ' ' || it.curr == '\\t' then consumeSpaces it.next (curr + 1) min\n else if it.curr == '\\n' then findNextLine it.next min\n else findNextLine it.next (Nat.min curr min)\n findNextLine (it : String.Iterator) (min : Nat) : Nat :=\n if it.atEnd then min\n else if it.curr == '\\n' then consumeSpaces it.next 0 min\n else findNextLine it.next min",
"start": [
165,
1
],
"end": [
178,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "String.removeNumLeadingSpaces",
"code": "private def removeNumLeadingSpaces (n : Nat) (s : String) : String :=\n consumeSpaces n s.iter \"\"\nwhere\n consumeSpaces (n : Nat) (it : String.Iterator) (r : String) : String :=\n match n with\n | 0 => saveLine it r\n | n+1 =>\n if it.atEnd then r\n else if it.curr == ' ' || it.curr == '\\t' then consumeSpaces n it.next r\n else saveLine it r\n termination_by (it, 1)\n saveLine (it : String.Iterator) (r : String) : String :=\n if it.atEnd then r\n else if it.curr == '\\n' then consumeSpaces n it.next (r.push '\\n')\n else saveLine it.next (r.push it.curr)\n termination_by (it, 0)",
"start": [
180,
1
],
"end": [
195,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "String.removeLeadingSpaces",
"code": "def removeLeadingSpaces (s : String) : String :=\n let n := findLeadingSpacesSize s\n if n == 0 then s else removeNumLeadingSpaces n s",
"start": [
197,
1
],
"end": [
199,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "String.crlfToLf",
"code": "def crlfToLf (text : String) : String :=\n go \"\" 0 0\nwhere\n go (acc : String) (accStop pos : String.Pos) : String :=\n if h : text.atEnd pos then\n if accStop = 0 then text else acc ++ text.extract accStop pos\n else\n let c := text.get' pos h\n let pos' := text.next' pos h\n if h' : ¬ text.atEnd pos' ∧ c == '\\r' ∧ text.get pos' == '\\n' then\n let acc := acc ++ text.extract accStop pos\n go acc pos' (text.next' pos' h'.1)\n else\n go acc accStop pos'\n termination_by text.utf8ByteSize - pos.byteIdx\n decreasing_by\n decreasing_with\n show text.utf8ByteSize - (text.next (text.next pos)).byteIdx < text.utf8ByteSize - pos.byteIdx\n have k := Nat.gt_of_not_le <| mt decide_eq_true h\n exact Nat.sub_lt_sub_left k (Nat.lt_trans (String.lt_next text pos) (String.lt_next _ _))\n decreasing_with\n show text.utf8ByteSize - (text.next pos).byteIdx < text.utf8ByteSize - pos.byteIdx\n have k := Nat.gt_of_not_le <| mt decide_eq_true h\n exact Nat.sub_lt_sub_left k (String.lt_next _ _)",
"start": [
201,
1
],
"end": [
230,
55
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/String/Lemmas.lean | [
".lake/packages/lean4/src/lean/Init/Data/Char/Lemmas.lean"
] | [
{
"full_name": "String.data_eq_of_eq",
"code": "protected theorem data_eq_of_eq {a b : String} (h : a = b) : a.data = b.data",
"start": [
11,
1
],
"end": [
12,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "String.ne_of_data_ne",
"code": "protected theorem ne_of_data_ne {a b : String} (h : a.data ≠ b.data) : a ≠ b",
"start": [
13,
1
],
"end": [
14,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "String.lt_irrefl",
"code": "@[simp] protected theorem lt_irrefl (s : String) : ¬ s < s",
"start": [
15,
1
],
"end": [
16,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "String.ne_of_lt",
"code": "protected theorem ne_of_lt {a b : String} (h : a < b) : a ≠ b",
"start": [
17,
1
],
"end": [
19,
34
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/AssocList.lean | [
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Data/List/Basic.lean"
] | [
{
"full_name": "Lean.AssocList",
"code": "inductive AssocList (α : Type u) (β : Type v) where\n | nil : AssocList α β\n | cons (key : α) (value : β) (tail : AssocList α β) : AssocList α β\n deriving Inhabited",
"start": [
12,
1
],
"end": [
16,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.empty",
"code": "abbrev empty : AssocList α β :=\n nil",
"start": [
21,
1
],
"end": [
22,
6
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.insert",
"code": "abbrev insert (m : AssocList α β) (k : α) (v : β) : AssocList α β :=\n m.cons k v",
"start": [
26,
1
],
"end": [
27,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.isEmpty",
"code": "def isEmpty : AssocList α β → Bool\n | nil => true\n | _ => false",
"start": [
29,
1
],
"end": [
31,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.foldlM",
"code": "@[specialize] def foldlM (f : δ → α → β → m δ) : (init : δ) → AssocList α β → m δ\n | d, nil => pure d\n | d, cons a b es => do\n let d ← f d a b\n foldlM f d es",
"start": [
33,
1
],
"end": [
37,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.foldl",
"code": "@[inline] def foldl (f : δ → α → β → δ) (init : δ) (as : AssocList α β) : δ :=\n Id.run (foldlM f init as)",
"start": [
39,
1
],
"end": [
40,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.toList",
"code": "def toList (as : AssocList α β) : List (α × β) :=\n as.foldl (init := []) (fun r a b => (a, b)::r) |>.reverse",
"start": [
42,
1
],
"end": [
43,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.forM",
"code": "@[specialize] def forM (f : α → β → m PUnit) : AssocList α β → m PUnit\n | nil => pure ⟨⟩\n | cons a b es => do f a b; forM f es",
"start": [
45,
1
],
"end": [
47,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.mapKey",
"code": "def mapKey (f : α → δ) : AssocList α β → AssocList δ β\n | nil => nil\n | cons k v t => cons (f k) v (mapKey f t)",
"start": [
49,
1
],
"end": [
51,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.mapVal",
"code": "def mapVal (f : β → δ) : AssocList α β → AssocList α δ\n | nil => nil\n | cons k v t => cons k (f v) (mapVal f t)",
"start": [
53,
1
],
"end": [
55,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.findEntry?",
"code": "def findEntry? [BEq α] (a : α) : AssocList α β → Option (α × β)\n | nil => none\n | cons k v es => match k == a with\n | true => some (k, v)\n | false => findEntry? a es",
"start": [
57,
1
],
"end": [
61,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.find?",
"code": "def find? [BEq α] (a : α) : AssocList α β → Option β\n | nil => none\n | cons k v es => match k == a with\n | true => some v\n | false => find? a es",
"start": [
63,
1
],
"end": [
67,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.contains",
"code": "def contains [BEq α] (a : α) : AssocList α β → Bool\n | nil => false\n | cons k _ es => k == a || contains a es",
"start": [
69,
1
],
"end": [
71,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.replace",
"code": "def replace [BEq α] (a : α) (b : β) : AssocList α β → AssocList α β\n | nil => nil\n | cons k v es => match k == a with\n | true => cons a b es\n | false => cons k v (replace a b es)",
"start": [
73,
1
],
"end": [
77,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.erase",
"code": "def erase [BEq α] (a : α) : AssocList α β → AssocList α β\n | nil => nil\n | cons k v es => match k == a with\n | true => es\n | false => cons k v (erase a es)",
"start": [
79,
1
],
"end": [
83,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.any",
"code": "def any (p : α → β → Bool) : AssocList α β → Bool\n | nil => false\n | cons k v es => p k v || any p es",
"start": [
85,
1
],
"end": [
87,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.all",
"code": "def all (p : α → β → Bool) : AssocList α β → Bool\n | nil => true\n | cons k v es => p k v && all p es",
"start": [
89,
1
],
"end": [
91,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.AssocList.forIn",
"code": "@[inline] protected def forIn {α : Type u} {β : Type v} {δ : Type w} {m : Type w → Type w'} [Monad m]\n (as : AssocList α β) (init : δ) (f : (α × β) → δ → m (ForInStep δ)) : m δ :=\n let rec @[specialize] loop\n | d, nil => pure d\n | d, cons k v es => do\n match (← f (k, v) d) with\n | ForInStep.done d => pure d\n | ForInStep.yield d => loop d es\n loop init as",
"start": [
93,
1
],
"end": [
101,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.List.toAssocList'",
"code": "def List.toAssocList' {α : Type u} {β : Type v} : List (α × β) → Lean.AssocList α β\n | [] => Lean.AssocList.nil\n | (a,b) :: es => Lean.AssocList.cons a b (toAssocList' es)",
"start": [
108,
1
],
"end": [
110,
61
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Array/BasicAux.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean",
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean",
".lake/packages/lean4/src/lean/Init/NotationExtra.lean"
] | [
{
"full_name": "Array.of_push_eq_push",
"code": "theorem Array.of_push_eq_push {as bs : Array α} (h : as.push a = bs.push b) : as = bs ∧ a = b",
"start": [
11,
1
],
"end": [
15,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "List.size_toArrayAux",
"code": "private theorem List.size_toArrayAux (as : List α) (bs : Array α) : (as.toArrayAux bs).size = as.length + bs.size",
"start": [
17,
1
],
"end": [
20,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.of_toArrayAux_eq_toArrayAux",
"code": "private theorem List.of_toArrayAux_eq_toArrayAux {as bs : List α} {cs ds : Array α} (h : as.toArrayAux cs = bs.toArrayAux ds) (hlen : cs.size = ds.size) : as = bs ∧ cs = ds",
"start": [
22,
1
],
"end": [
33,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toArray_eq_toArray_eq",
"code": "@[simp] theorem List.toArray_eq_toArray_eq (as bs : List α) : (as.toArray = bs.toArray) = (as = bs)",
"start": [
35,
1
],
"end": [
38,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapM'",
"code": "def Array.mapM' [Monad m] (f : α → m β) (as : Array α) : m { bs : Array β // bs.size = as.size } :=\n go 0 ⟨mkEmpty as.size, rfl⟩ (by simp_arith)\nwhere\n go (i : Nat) (acc : { bs : Array β // bs.size = i }) (hle : i ≤ as.size) : m { bs : Array β // bs.size = as.size } := do\n if h : i = as.size then\n return h ▸ acc\n else\n have hlt : i < as.size := Nat.lt_of_le_of_ne hle h\n let b ← f as[i]\n go (i+1) ⟨acc.val.push b, by simp [acc.property]⟩ hlt\n termination_by as.size - i\n decreasing_by decreasing_trivial_pre_omega",
"start": [
40,
1
],
"end": [
51,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "mapMonoMImp",
"code": "@[inline] private unsafe def mapMonoMImp [Monad m] (as : Array α) (f : α → m α) : m (Array α) :=\n go 0 as\nwhere\n @[specialize] go (i : Nat) (as : Array α) : m (Array α) := do\n if h : i < as.size then\n let a := as[i]\n let b ← f a\n if ptrEq a b then\n go (i+1) as\n else\n go (i+1) (as.set ⟨i, h⟩ b)\n else\n return as",
"start": [
53,
1
],
"end": [
65,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapMonoM",
"code": "@[implemented_by mapMonoMImp] def Array.mapMonoM [Monad m] (as : Array α) (f : α → m α) : m (Array α) :=\n as.mapM f",
"start": [
67,
1
],
"end": [
72,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Array.mapMono",
"code": "@[inline] def Array.mapMono (as : Array α) (f : α → α) : Array α :=\n Id.run <| as.mapMonoM f",
"start": [
74,
1
],
"end": [
75,
26
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/String.lean | [
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Lemmas.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Extra.lean"
] | [] |
.lake/packages/lean4/src/lean/Lean/Data/HashMap.lean | [
".lake/packages/lean4/src/lean/Lean/Data/AssocList.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Power2.lean"
] | [
{
"full_name": "Lean.HashMapBucket",
"code": "def HashMapBucket (α : Type u) (β : Type v) :=\n { b : Array (AssocList α β) // b.size.isPowerOfTwo }",
"start": [
11,
1
],
"end": [
12,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapBucket.update",
"code": "def HashMapBucket.update {α : Type u} {β : Type v} (data : HashMapBucket α β) (i : USize) (d : AssocList α β) (h : i.toNat < data.val.size) : HashMapBucket α β :=\n ⟨ data.val.uset i d h,\n by erw [Array.size_set]; apply data.property ⟩",
"start": [
14,
1
],
"end": [
16,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapBucket.size_update",
"code": "@[simp] theorem HashMapBucket.size_update {α : Type u} {β : Type v} (data : HashMapBucket α β) (i : USize) (d : AssocList α β)\n (h : i.toNat < data.val.size) : (data.update i d h).val.size = data.val.size",
"start": [
18,
1
],
"end": [
20,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp",
"code": "structure HashMapImp (α : Type u) (β : Type v) where\n size : Nat\n buckets : HashMapBucket α β",
"start": [
22,
1
],
"end": [
24,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.numBucketsForCapacity",
"code": "private def numBucketsForCapacity (capacity : Nat) : Nat :=\n capacity * 4 / 3",
"start": [
26,
1
],
"end": [
28,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkHashMapImp",
"code": "def mkHashMapImp {α : Type u} {β : Type v} (capacity := 8) : HashMapImp α β :=\n { size := 0\n buckets :=\n ⟨mkArray (numBucketsForCapacity capacity).nextPowerOfTwo AssocList.nil,\n by simp; apply Nat.isPowerOfTwo_nextPowerOfTwo⟩ }",
"start": [
30,
1
],
"end": [
34,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.mkIdx",
"code": "@[extern \"lean_hashmap_mk_idx\"]\nprivate def mkIdx {sz : Nat} (hash : UInt64) (h : sz.isPowerOfTwo) : { u : USize // u.toNat < sz } :=\n let u := hash.toUSize &&& (sz.toUSize - 1)\n if h' : u.toNat < sz then\n ⟨u, h'⟩\n else\n ⟨0, by simp [USize.toNat, OfNat.ofNat, USize.ofNat, Fin.ofNat']; apply Nat.pos_of_isPowerOfTwo h⟩",
"start": [
40,
1
],
"end": [
47,
102
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.reinsertAux",
"code": "@[inline] def reinsertAux (hashFn : α → UInt64) (data : HashMapBucket α β) (a : α) (b : β) : HashMapBucket α β :=\n let ⟨i, h⟩ := mkIdx (hashFn a) data.property\n data.update i (AssocList.cons a b data.val[i]) h",
"start": [
49,
1
],
"end": [
51,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.foldBucketsM",
"code": "@[inline] def foldBucketsM {δ : Type w} {m : Type w → Type w} [Monad m] (data : HashMapBucket α β) (d : δ) (f : δ → α → β → m δ) : m δ :=\n data.val.foldlM (init := d) fun d b => b.foldlM f d",
"start": [
53,
1
],
"end": [
54,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.foldBuckets",
"code": "@[inline] def foldBuckets {δ : Type w} (data : HashMapBucket α β) (d : δ) (f : δ → α → β → δ) : δ :=\n Id.run $ foldBucketsM data d f",
"start": [
56,
1
],
"end": [
57,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.foldM",
"code": "@[inline] def foldM {δ : Type w} {m : Type w → Type w} [Monad m] (f : δ → α → β → m δ) (d : δ) (h : HashMapImp α β) : m δ :=\n foldBucketsM h.buckets d f",
"start": [
59,
1
],
"end": [
60,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.fold",
"code": "@[inline] def fold {δ : Type w} (f : δ → α → β → δ) (d : δ) (m : HashMapImp α β) : δ :=\n foldBuckets m.buckets d f",
"start": [
62,
1
],
"end": [
63,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.forBucketsM",
"code": "@[inline] def forBucketsM {m : Type w → Type w} [Monad m] (data : HashMapBucket α β) (f : α → β → m PUnit) : m PUnit :=\n data.val.forM fun b => b.forM f",
"start": [
65,
1
],
"end": [
66,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.forM",
"code": "@[inline] def forM {m : Type w → Type w} [Monad m] (f : α → β → m PUnit) (h : HashMapImp α β) : m PUnit :=\n forBucketsM h.buckets f",
"start": [
68,
1
],
"end": [
69,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.findEntry?",
"code": "def findEntry? [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option (α × β) :=\n match m with\n | ⟨_, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n buckets.val[i].findEntry? a",
"start": [
71,
1
],
"end": [
75,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.find?",
"code": "def find? [beq : BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option β :=\n match m with\n | ⟨_, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n buckets.val[i].find? a",
"start": [
77,
1
],
"end": [
81,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.contains",
"code": "def contains [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Bool :=\n match m with\n | ⟨_, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n buckets.val[i].contains a",
"start": [
83,
1
],
"end": [
87,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.moveEntries",
"code": "def moveEntries [Hashable α] (i : Nat) (source : Array (AssocList α β)) (target : HashMapBucket α β) : HashMapBucket α β :=\n if h : i < source.size then\n let idx : Fin source.size := ⟨i, h⟩\n let es : AssocList α β := source.get idx\n let source := source.set idx AssocList.nil\n let target := es.foldl (reinsertAux hash) target\n moveEntries (i+1) source target\n else target\ntermination_by source.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
89,
1
],
"end": [
99,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.expand",
"code": "def expand [Hashable α] (size : Nat) (buckets : HashMapBucket α β) : HashMapImp α β :=\n let bucketsNew : HashMapBucket α β := ⟨\n mkArray (buckets.val.size * 2) AssocList.nil,\n by simp; apply Nat.mul2_isPowerOfTwo_of_isPowerOfTwo buckets.property\n ⟩\n { size := size,\n buckets := moveEntries 0 buckets.val bucketsNew }",
"start": [
101,
1
],
"end": [
107,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.insert",
"code": "@[inline] def insert [beq : BEq α] [Hashable α] (m : HashMapImp α β) (a : α) (b : β) : HashMapImp α β × Bool :=\n match m with\n | ⟨size, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n let bkt := buckets.val[i]\n if bkt.contains a then\n let buckets' := buckets.update i .nil h\n (⟨size, buckets'.update i (bkt.replace a b) (by simpa [buckets'])⟩, true)\n else\n let size' := size + 1\n let buckets' := buckets.update i (AssocList.cons a b bkt) h\n if numBucketsForCapacity size' ≤ buckets.val.size then\n ({ size := size', buckets := buckets' }, false)\n else\n (expand size' buckets', false)",
"start": [
109,
1
],
"end": [
124,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.insertIfNew",
"code": "@[inline] def insertIfNew [beq : BEq α] [Hashable α] (m : HashMapImp α β) (a : α) (b : β) : HashMapImp α β × Option β :=\n match m with\n | ⟨size, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n let bkt := buckets.val[i]\n if let some b := bkt.find? a then\n (⟨size, buckets⟩, some b)\n else\n let size' := size + 1\n let buckets' := buckets.update i (AssocList.cons a b bkt) h\n if numBucketsForCapacity size' ≤ buckets.val.size then\n ({ size := size', buckets := buckets' }, none)\n else\n (expand size' buckets', none)",
"start": [
126,
1
],
"end": [
139,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.erase",
"code": "def erase [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : HashMapImp α β :=\n match m with\n | ⟨ size, buckets ⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n let bkt := buckets.val[i]\n if bkt.contains a then\n let buckets' := buckets.update i .nil h\n ⟨size - 1, buckets'.update i (bkt.erase a) (by simpa [buckets'])⟩\n else\n ⟨size, buckets⟩",
"start": [
142,
1
],
"end": [
152,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMapImp.WellFormed",
"code": "inductive WellFormed [BEq α] [Hashable α] : HashMapImp α β → Prop where\n | mkWff : ∀ n, WellFormed (mkHashMapImp n)\n | insertWff : ∀ m a b, WellFormed m → WellFormed (insert m a b |>.1)\n | insertIfNewWff : ∀ m a b, WellFormed m → WellFormed (insertIfNew m a b |>.1)\n | eraseWff : ∀ m a, WellFormed m → WellFormed (erase m a)",
"start": [
154,
1
],
"end": [
158,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap",
"code": "def HashMap (α : Type u) (β : Type v) [BEq α] [Hashable α] :=\n { m : HashMapImp α β // m.WellFormed }",
"start": [
162,
1
],
"end": [
163,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkHashMap",
"code": "def mkHashMap {α : Type u} {β : Type v} [BEq α] [Hashable α] (capacity := 8) : HashMap α β :=\n ⟨ mkHashMapImp capacity, WellFormed.mkWff capacity ⟩",
"start": [
167,
1
],
"end": [
168,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.empty",
"code": "@[inline] def empty [BEq α] [Hashable α] : HashMap α β :=\n mkHashMap",
"start": [
176,
1
],
"end": [
177,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.insert",
"code": "def insert (m : HashMap α β) (a : α) (b : β) : HashMap α β :=\n match m with\n | ⟨ m, hw ⟩ =>\n match h:m.insert a b with\n | (m', _) => ⟨ m', by have aux := WellFormed.insertWff m a b hw; rw [h] at aux; assumption ⟩",
"start": [
181,
1
],
"end": [
185,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.insert'",
"code": "def insert' (m : HashMap α β) (a : α) (b : β) : HashMap α β × Bool :=\n match m with\n | ⟨ m, hw ⟩ =>\n match h:m.insert a b with\n | (m', replaced) => (⟨ m', by have aux := WellFormed.insertWff m a b hw; rw [h] at aux; assumption ⟩, replaced)",
"start": [
187,
1
],
"end": [
192,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.insertIfNew",
"code": "def insertIfNew (m : HashMap α β) (a : α) (b : β) : HashMap α β × Option β :=\n match m with\n | ⟨ m, hw ⟩ =>\n match h:m.insertIfNew a b with\n | (m', old) => (⟨ m', by have aux := WellFormed.insertIfNewWff m a b hw; rw [h] at aux; assumption ⟩, old)",
"start": [
194,
1
],
"end": [
201,
111
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.erase",
"code": "@[inline] def erase (m : HashMap α β) (a : α) : HashMap α β :=\n match m with\n | ⟨ m, hw ⟩ => ⟨ m.erase a, WellFormed.eraseWff m a hw ⟩",
"start": [
203,
1
],
"end": [
205,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.findEntry?",
"code": "@[inline] def findEntry? (m : HashMap α β) (a : α) : Option (α × β) :=\n match m with\n | ⟨ m, _ ⟩ => m.findEntry? a",
"start": [
207,
1
],
"end": [
209,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.find?",
"code": "@[inline] def find? (m : HashMap α β) (a : α) : Option β :=\n match m with\n | ⟨ m, _ ⟩ => m.find? a",
"start": [
211,
1
],
"end": [
213,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.findD",
"code": "@[inline] def findD (m : HashMap α β) (a : α) (b₀ : β) : β :=\n (m.find? a).getD b₀",
"start": [
215,
1
],
"end": [
216,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.find!",
"code": "@[inline] def find! [Inhabited β] (m : HashMap α β) (a : α) : β :=\n match m.find? a with\n | some b => b\n | none => panic! \"key is not in the map\"",
"start": [
218,
1
],
"end": [
221,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.contains",
"code": "@[inline] def contains (m : HashMap α β) (a : α) : Bool :=\n match m with\n | ⟨ m, _ ⟩ => m.contains a",
"start": [
226,
1
],
"end": [
228,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.foldM",
"code": "@[inline] def foldM {δ : Type w} {m : Type w → Type w} [Monad m] (f : δ → α → β → m δ) (init : δ) (h : HashMap α β) : m δ :=\n match h with\n | ⟨ h, _ ⟩ => h.foldM f init",
"start": [
230,
1
],
"end": [
232,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.fold",
"code": "@[inline] def fold {δ : Type w} (f : δ → α → β → δ) (init : δ) (m : HashMap α β) : δ :=\n match m with\n | ⟨ m, _ ⟩ => m.fold f init",
"start": [
234,
1
],
"end": [
236,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.forM",
"code": "@[inline] def forM {m : Type w → Type w} [Monad m] (f : α → β → m PUnit) (h : HashMap α β) : m PUnit :=\n match h with\n | ⟨ h, _ ⟩ => h.forM f",
"start": [
238,
1
],
"end": [
240,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.size",
"code": "@[inline] def size (m : HashMap α β) : Nat :=\n match m with\n | ⟨ {size := sz, ..}, _ ⟩ => sz",
"start": [
242,
1
],
"end": [
244,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.isEmpty",
"code": "@[inline] def isEmpty (m : HashMap α β) : Bool :=\n m.size = 0",
"start": [
246,
1
],
"end": [
247,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.toList",
"code": "def toList (m : HashMap α β) : List (α × β) :=\n m.fold (init := []) fun r k v => (k, v)::r",
"start": [
249,
1
],
"end": [
250,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.toArray",
"code": "def toArray (m : HashMap α β) : Array (α × β) :=\n m.fold (init := #[]) fun r k v => r.push (k, v)",
"start": [
252,
1
],
"end": [
253,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.numBuckets",
"code": "def numBuckets (m : HashMap α β) : Nat :=\n m.val.buckets.val.size",
"start": [
255,
1
],
"end": [
256,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.ofList",
"code": "def ofList (l : List (α × β)) : HashMap α β :=\n l.foldl (init := HashMap.empty) (fun m p => m.insert p.fst p.snd)",
"start": [
260,
1
],
"end": [
262,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashMap.ofListWith",
"code": "def ofListWith (l : List (α × β)) (f : β → β → β) : HashMap α β :=\n l.foldl (init := HashMap.empty)\n (fun m p =>\n match m.find? p.fst with\n | none => m.insert p.fst p.snd\n | some v => m.insert p.fst $ f v p.snd)",
"start": [
264,
1
],
"end": [
270,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Array.groupByKey",
"code": "def Array.groupByKey [BEq α] [Hashable α] (key : β → α) (xs : Array β)\n : Lean.HashMap α (Array β) := Id.run do\n let mut groups := ∅\n for x in xs do\n let group := groups.findD (key x) #[]\n groups := groups.erase (key x) groups := groups.insert (key x) (group.push x)\n return groups",
"start": [
274,
1
],
"end": [
285,
16
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/PersistentHashMap.lean | [
".lake/packages/lean4/src/lean/Init/Data/Array/BasicAux.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Macro.lean"
] | [
{
"full_name": "Lean.PersistentHashMap.Entry",
"code": "inductive Entry (α : Type u) (β : Type v) (σ : Type w) where\n | entry (key : α) (val : β) : Entry α β σ\n | ref (node : σ) : Entry α β σ\n | null : Entry α β σ",
"start": [
15,
1
],
"end": [
18,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.Node",
"code": "inductive Node (α : Type u) (β : Type v) : Type (max u v) where\n | entries (es : Array (Entry α β (Node α β))) : Node α β\n | collision (ks : Array α) (vs : Array β) (h : ks.size = vs.size) : Node α β",
"start": [
22,
1
],
"end": [
24,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.Node.isEmpty",
"code": "partial def Node.isEmpty : Node α β → Bool\n | .collision .. => false\n | .entries es => es.all fun\n | .entry .. => false\n | .ref n => n.isEmpty\n | .null => true",
"start": [
26,
1
],
"end": [
31,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.shift",
"code": "abbrev shift : USize := 5",
"start": [
35,
1
],
"end": [
35,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.branching",
"code": "abbrev branching : USize := USize.ofNat (2 ^ shift.toNat)",
"start": [
36,
1
],
"end": [
36,
63
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.maxDepth",
"code": "abbrev maxDepth : USize := 7",
"start": [
37,
1
],
"end": [
37,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.maxCollisions",
"code": "abbrev maxCollisions : Nat := 4",
"start": [
38,
1
],
"end": [
38,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mkEmptyEntriesArray",
"code": "def mkEmptyEntriesArray {α β} : Array (Entry α β (Node α β)) :=\n (Array.mkArray PersistentHashMap.branching.toNat PersistentHashMap.Entry.null)",
"start": [
40,
1
],
"end": [
41,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap",
"code": "structure PersistentHashMap (α : Type u) (β : Type v) [BEq α] [Hashable α] where\n root : PersistentHashMap.Node α β := PersistentHashMap.Node.entries PersistentHashMap.mkEmptyEntriesArray",
"start": [
45,
1
],
"end": [
46,
108
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PHashMap",
"code": "abbrev PHashMap (α : Type u) (β : Type v) [BEq α] [Hashable α] := PersistentHashMap α β",
"start": [
48,
1
],
"end": [
48,
88
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.empty",
"code": "def empty [BEq α] [Hashable α] : PersistentHashMap α β := {}",
"start": [
52,
1
],
"end": [
52,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.isEmpty",
"code": "def isEmpty {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → Bool\n | { root } => root.isEmpty",
"start": [
54,
1
],
"end": [
55,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mkEmptyEntries",
"code": "def mkEmptyEntries {α β} : Node α β :=\n Node.entries mkEmptyEntriesArray",
"start": [
59,
1
],
"end": [
60,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mul2Shift",
"code": "abbrev mul2Shift (i : USize) (shift : USize) : USize := i.shiftLeft shift",
"start": [
62,
1
],
"end": [
62,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.div2Shift",
"code": "abbrev div2Shift (i : USize) (shift : USize) : USize := i.shiftRight shift",
"start": [
63,
1
],
"end": [
63,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mod2Shift",
"code": "abbrev mod2Shift (i : USize) (shift : USize) : USize := USize.land i ((USize.shiftLeft 1 shift) - 1)",
"start": [
64,
1
],
"end": [
64,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.IsCollisionNode",
"code": "inductive IsCollisionNode : Node α β → Prop where\n | mk (keys : Array α) (vals : Array β) (h : keys.size = vals.size) : IsCollisionNode (Node.collision keys vals h)",
"start": [
66,
1
],
"end": [
67,
116
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.CollisionNode",
"code": "abbrev CollisionNode (α β) := { n : Node α β // IsCollisionNode n }",
"start": [
69,
1
],
"end": [
69,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.IsEntriesNode",
"code": "inductive IsEntriesNode : Node α β → Prop where\n | mk (entries : Array (Entry α β (Node α β))) : IsEntriesNode (Node.entries entries)",
"start": [
71,
1
],
"end": [
72,
87
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.EntriesNode",
"code": "abbrev EntriesNode (α β) := { n : Node α β // IsEntriesNode n }",
"start": [
74,
1
],
"end": [
74,
64
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.size_set",
"code": "private theorem size_set {ks : Array α} {vs : Array β} (h : ks.size = vs.size) (i : Fin ks.size) (j : Fin vs.size) (k : α) (v : β)\n : (ks.set i k).size = (vs.set j v).size",
"start": [
76,
1
],
"end": [
78,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.size_push",
"code": "private theorem size_push {ks : Array α} {vs : Array β} (h : ks.size = vs.size) (k : α) (v : β) : (ks.push k).size = (vs.push v).size",
"start": [
80,
1
],
"end": [
81,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.insertAtCollisionNodeAux",
"code": "partial def insertAtCollisionNodeAux [BEq α] : CollisionNode α β → Nat → α → β → CollisionNode α β\n | n@⟨Node.collision keys vals heq, _⟩, i, k, v =>\n if h : i < keys.size then\n let idx : Fin keys.size := ⟨i, h⟩;\n let k' := keys.get idx;\n if k == k' then\n let j : Fin vals.size := ⟨i, by rw [←heq]; assumption⟩\n ⟨Node.collision (keys.set idx k) (vals.set j v) (size_set heq idx j k v), IsCollisionNode.mk _ _ _⟩\n else insertAtCollisionNodeAux n (i+1) k v\n else\n ⟨Node.collision (keys.push k) (vals.push v) (size_push heq k v), IsCollisionNode.mk _ _ _⟩\n | ⟨Node.entries _, h⟩, _, _, _ => nomatch h",
"start": [
83,
1
],
"end": [
94,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.insertAtCollisionNode",
"code": "def insertAtCollisionNode [BEq α] : CollisionNode α β → α → β → CollisionNode α β :=\n fun n k v => insertAtCollisionNodeAux n 0 k v",
"start": [
96,
1
],
"end": [
97,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.getCollisionNodeSize",
"code": "def getCollisionNodeSize : CollisionNode α β → Nat\n | ⟨Node.collision keys _ _, _⟩ => keys.size\n | ⟨Node.entries _, h⟩ => nomatch h",
"start": [
99,
1
],
"end": [
101,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mkCollisionNode",
"code": "def mkCollisionNode (k₁ : α) (v₁ : β) (k₂ : α) (v₂ : β) : Node α β :=\n let ks : Array α := Array.mkEmpty maxCollisions\n let ks := (ks.push k₁).push k₂\n let vs : Array β := Array.mkEmpty maxCollisions\n let vs := (vs.push v₁).push v₂\n Node.collision ks vs rfl",
"start": [
103,
1
],
"end": [
108,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.insertAux",
"code": "partial def insertAux [BEq α] [Hashable α] : Node α β → USize → USize → α → β → Node α β\n | Node.collision keys vals heq, _, depth, k, v =>\n let newNode := insertAtCollisionNode ⟨Node.collision keys vals heq, IsCollisionNode.mk _ _ _⟩ k v\n if depth >= maxDepth || getCollisionNodeSize newNode < maxCollisions then newNode.val\n else match newNode with\n | ⟨Node.entries _, h⟩ => nomatch h\n | ⟨Node.collision keys vals heq, _⟩ =>\n let rec traverse (i : Nat) (entries : Node α β) : Node α β :=\n if h : i < keys.size then\n let k := keys[i]\n have : i < vals.size := heq ▸ h\n let v := vals[i]\n let h := hash k |>.toUSize\n let h := div2Shift h (shift * (depth - 1))\n traverse (i+1) (insertAux entries h depth k v)\n else\n entries\n traverse 0 mkEmptyEntries\n | Node.entries entries, h, depth, k, v =>\n let j := (mod2Shift h shift).toNat\n Node.entries $ entries.modify j fun entry =>\n match entry with\n | Entry.null => Entry.entry k v\n | Entry.ref node => Entry.ref $ insertAux node (div2Shift h shift) (depth+1) k v\n | Entry.entry k' v' =>\n if k == k' then Entry.entry k v\n else Entry.ref $ mkCollisionNode k' v' k v",
"start": [
110,
1
],
"end": [
136,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.insert",
"code": "def insert {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → α → β → PersistentHashMap α β\n | { root }, k, v => { root := insertAux root (hash k |>.toUSize) 1 k v }",
"start": [
138,
1
],
"end": [
139,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findAtAux",
"code": "partial def findAtAux [BEq α] (keys : Array α) (vals : Array β) (heq : keys.size = vals.size) (i : Nat) (k : α) : Option β :=\n if h : i < keys.size then\n let k' := keys[i]\n have : i < vals.size := by rw [←heq]; assumption\n if k == k' then some vals[i]\n else findAtAux keys vals heq (i+1) k\n else none",
"start": [
141,
1
],
"end": [
147,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findAux",
"code": "partial def findAux [BEq α] : Node α β → USize → α → Option β\n | Node.entries entries, h, k =>\n let j := (mod2Shift h shift).toNat\n match entries.get! j with\n | Entry.null => none\n | Entry.ref node => findAux node (div2Shift h shift) k\n | Entry.entry k' v => if k == k' then some v else none\n | Node.collision keys vals heq, _, k => findAtAux keys vals heq 0 k",
"start": [
149,
1
],
"end": [
156,
70
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.find?",
"code": "def find? {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → α → Option β\n | { root }, k => findAux root (hash k |>.toUSize) k",
"start": [
158,
1
],
"end": [
159,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findD",
"code": "@[inline] def findD {_ : BEq α} {_ : Hashable α} (m : PersistentHashMap α β) (a : α) (b₀ : β) : β :=\n (m.find? a).getD b₀",
"start": [
164,
1
],
"end": [
165,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.find!",
"code": "@[inline] def find! {_ : BEq α} {_ : Hashable α} [Inhabited β] (m : PersistentHashMap α β) (a : α) : β :=\n match m.find? a with\n | some b => b\n | none => panic! \"key is not in the map\"",
"start": [
167,
1
],
"end": [
170,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findEntryAtAux",
"code": "partial def findEntryAtAux [BEq α] (keys : Array α) (vals : Array β) (heq : keys.size = vals.size) (i : Nat) (k : α) : Option (α × β) :=\n if h : i < keys.size then\n let k' := keys[i]\n have : i < vals.size := by rw [←heq]; assumption\n if k == k' then some (k', vals[i])\n else findEntryAtAux keys vals heq (i+1) k\n else none",
"start": [
172,
1
],
"end": [
178,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findEntryAux",
"code": "partial def findEntryAux [BEq α] : Node α β → USize → α → Option (α × β)\n | Node.entries entries, h, k =>\n let j := (mod2Shift h shift).toNat\n match entries.get! j with\n | Entry.null => none\n | Entry.ref node => findEntryAux node (div2Shift h shift) k\n | Entry.entry k' v => if k == k' then some (k', v) else none\n | Node.collision keys vals heq, _, k => findEntryAtAux keys vals heq 0 k",
"start": [
180,
1
],
"end": [
187,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.findEntry?",
"code": "def findEntry? {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → α → Option (α × β)\n | { root }, k => findEntryAux root (hash k |>.toUSize) k",
"start": [
189,
1
],
"end": [
190,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.containsAtAux",
"code": "partial def containsAtAux [BEq α] (keys : Array α) (vals : Array β) (heq : keys.size = vals.size) (i : Nat) (k : α) : Bool :=\n if h : i < keys.size then\n let k' := keys[i]\n if k == k' then true\n else containsAtAux keys vals heq (i+1) k\n else false",
"start": [
192,
1
],
"end": [
197,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.containsAux",
"code": "partial def containsAux [BEq α] : Node α β → USize → α → Bool\n | Node.entries entries, h, k =>\n let j := (mod2Shift h shift).toNat\n match entries.get! j with\n | Entry.null => false\n | Entry.ref node => containsAux node (div2Shift h shift) k\n | Entry.entry k' _ => k == k'\n | Node.collision keys vals heq, _, k => containsAtAux keys vals heq 0 k",
"start": [
199,
1
],
"end": [
206,
74
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.contains",
"code": "def contains [BEq α] [Hashable α] : PersistentHashMap α β → α → Bool\n | { root }, k => containsAux root (hash k |>.toUSize) k",
"start": [
208,
1
],
"end": [
209,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.isUnaryEntries",
"code": "partial def isUnaryEntries (a : Array (Entry α β (Node α β))) (i : Nat) (acc : Option (α × β)) : Option (α × β) :=\n if h : i < a.size then\n match a[i] with\n | Entry.null => isUnaryEntries a (i+1) acc\n | Entry.ref _ => none\n | Entry.entry k v =>\n match acc with\n | none => isUnaryEntries a (i+1) (some (k, v))\n | some _ => none\n else acc",
"start": [
211,
1
],
"end": [
220,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.isUnaryNode",
"code": "def isUnaryNode : Node α β → Option (α × β)\n | Node.entries entries => isUnaryEntries entries 0 none\n | Node.collision keys vals heq =>\n if h : 1 = keys.size then\n have : 0 < keys.size := by rw [←h]; decide\n have : 0 < vals.size := by rw [←heq]; assumption\n some (keys[0], vals[0])\n else\n none",
"start": [
222,
1
],
"end": [
230,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.eraseAux",
"code": "partial def eraseAux [BEq α] : Node α β → USize → α → Node α β\n | n@(Node.collision keys vals heq), _, k =>\n match keys.indexOf? k with\n | some idx =>\n let keys' := keys.feraseIdx idx\n have keq := keys.size_feraseIdx idx\n let vals' := vals.feraseIdx (Eq.ndrec idx heq)\n have veq := vals.size_feraseIdx (Eq.ndrec idx heq)\n have : keys.size - 1 = vals.size - 1 := by rw [heq]\n Node.collision keys' vals' (keq.trans (this.trans veq.symm))\n | none => n\n | n@(Node.entries entries), h, k =>\n let j := (mod2Shift h shift).toNat\n let entry := entries.get! j\n match entry with\n | Entry.null => n\n | Entry.entry k' _ =>\n if k == k' then Node.entries (entries.set! j Entry.null) else n\n | Entry.ref node =>\n let entries := entries.set! j Entry.null\n let newNode := eraseAux node (div2Shift h shift) k\n match isUnaryNode newNode with\n | none => Node.entries (entries.set! j (Entry.ref newNode))\n | some (k, v) => Node.entries (entries.set! j (Entry.entry k v))",
"start": [
232,
1
],
"end": [
255,
71
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.erase",
"code": "def erase {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → α → PersistentHashMap α β\n | { root }, k =>\n let h := hash k |>.toUSize\n { root := eraseAux root h k }",
"start": [
257,
1
],
"end": [
260,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.foldlMAux",
"code": "partial def foldlMAux (f : σ → α → β → m σ) : Node α β → σ → m σ\n | Node.collision keys vals heq, acc =>\n let rec traverse (i : Nat) (acc : σ) : m σ := do\n if h : i < keys.size then\n let k := keys[i]\n have : i < vals.size := heq ▸ h\n let v := vals[i]\n traverse (i+1) (← f acc k v)\n else\n pure acc\n traverse 0 acc\n | Node.entries entries, acc => entries.foldlM (fun acc entry =>\n match entry with\n | Entry.null => pure acc\n | Entry.entry k v => f acc k v\n | Entry.ref node => foldlMAux f node acc)\n acc",
"start": [
266,
1
],
"end": [
282,
8
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.foldlM",
"code": "def foldlM {_ : BEq α} {_ : Hashable α} (map : PersistentHashMap α β) (f : σ → α → β → m σ) (init : σ) : m σ :=\n foldlMAux f map.root init",
"start": [
284,
1
],
"end": [
285,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.forM",
"code": "def forM {_ : BEq α} {_ : Hashable α} (map : PersistentHashMap α β) (f : α → β → m PUnit) : m PUnit :=\n map.foldlM (fun _ => f) ⟨⟩",
"start": [
287,
1
],
"end": [
288,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.foldl",
"code": "def foldl {_ : BEq α} {_ : Hashable α} (map : PersistentHashMap α β) (f : σ → α → β → σ) (init : σ) : σ :=\n Id.run <| map.foldlM f init",
"start": [
290,
1
],
"end": [
291,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.forIn",
"code": "protected def forIn {_ : BEq α} {_ : Hashable α} [Monad m]\n (map : PersistentHashMap α β) (init : σ) (f : α × β → σ → m (ForInStep σ)) : m σ := do\n let intoError : ForInStep σ → Except σ σ\n | .done s => .error s\n | .yield s => .ok s\n let result ← foldlM (m := ExceptT σ m) map (init := init) fun s a b =>\n (intoError <$> f (a, b) s : m _)\n match result with\n | .ok s | .error s => pure s",
"start": [
293,
1
],
"end": [
301,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mapMAux",
"code": "partial def mapMAux {α : Type u} {β : Type v} {σ : Type u} {m : Type u → Type w} [Monad m] (f : β → m σ) (n : Node α β) : m (Node α σ) := do\n match n with\n | .collision keys vals heq =>\n let ⟨vals', h⟩ ← vals.mapM' f\n return .collision keys vals' (h ▸ heq)\n | .entries entries =>\n let entries' ← entries.mapM fun\n | .null => return .null\n | .entry k v => return .entry k (← f v)\n | .ref node => return .ref (← mapMAux f node)\n return .entries entries'",
"start": [
308,
1
],
"end": [
318,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.mapM",
"code": "def mapM {α : Type u} {β : Type v} {σ : Type u} {m : Type u → Type w} [Monad m] {_ : BEq α} {_ : Hashable α} (pm : PersistentHashMap α β) (f : β → m σ) : m (PersistentHashMap α σ) := do\n let root ← mapMAux f pm.root\n return { root }",
"start": [
320,
1
],
"end": [
322,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.map",
"code": "def map {α : Type u} {β : Type v} {σ : Type u} {_ : BEq α} {_ : Hashable α} (pm : PersistentHashMap α β) (f : β → σ) : PersistentHashMap α σ :=\n Id.run <| pm.mapM f",
"start": [
324,
1
],
"end": [
325,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.toList",
"code": "def toList {_ : BEq α} {_ : Hashable α} (m : PersistentHashMap α β) : List (α × β) :=\n m.foldl (init := []) fun ps k v => (k, v) :: ps",
"start": [
327,
1
],
"end": [
328,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.toArray",
"code": "def toArray {_ : BEq α} {_ : Hashable α} (m : PersistentHashMap α β) : Array (α × β) :=\n m.foldl (init := #[]) fun ps k v => ps.push (k, v)",
"start": [
330,
1
],
"end": [
331,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.Stats",
"code": "structure Stats where\n numNodes : Nat := 0\n numNull : Nat := 0\n numCollisions : Nat := 0\n maxDepth : Nat := 0",
"start": [
333,
1
],
"end": [
337,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.collectStats",
"code": "partial def collectStats : Node α β → Stats → Nat → Stats\n | Node.collision keys _ _, stats, depth =>\n { stats with\n numNodes := stats.numNodes + 1,\n numCollisions := stats.numCollisions + keys.size - 1,\n maxDepth := Nat.max stats.maxDepth depth }\n | Node.entries entries, stats, depth =>\n let stats :=\n { stats with\n numNodes := stats.numNodes + 1,\n maxDepth := Nat.max stats.maxDepth depth }\n entries.foldl (fun stats entry =>\n match entry with\n | Entry.null => { stats with numNull := stats.numNull + 1 }\n | Entry.ref node => collectStats node stats (depth + 1)\n | Entry.entry _ _ => stats)\n stats",
"start": [
339,
1
],
"end": [
355,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.stats",
"code": "def stats {_ : BEq α} {_ : Hashable α} (m : PersistentHashMap α β) : Stats :=\n collectStats m.root {} 1",
"start": [
357,
1
],
"end": [
358,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.PersistentHashMap.Stats.toString",
"code": "def Stats.toString (s : Stats) : String :=\n s!\"\\{ nodes := {s.numNodes}, null := {s.numNull}, collisions := {s.numCollisions}, depth := {s.maxDepth}}\"",
"start": [
360,
1
],
"end": [
361,
109
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Ord.lean | [
".lake/packages/lean4/src/lean/Init/Data/String.lean",
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean"
] | [
{
"full_name": "Ordering",
"code": "inductive Ordering where\n | lt | eq | gt\nderiving Inhabited, BEq",
"start": [
11,
1
],
"end": [
13,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.swap",
"code": "def swap : Ordering → Ordering\n | .lt => .gt\n | .eq => .eq\n | .gt => .lt",
"start": [
19,
1
],
"end": [
23,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.then",
"code": "@[macro_inline] def «then» : Ordering → Ordering → Ordering\n | .eq, f => f\n | o, _ => o",
"start": [
25,
1
],
"end": [
45,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isEq",
"code": "def isEq : Ordering → Bool\n | eq => true\n | _ => false",
"start": [
47,
1
],
"end": [
52,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isNe",
"code": "def isNe : Ordering → Bool\n | eq => false\n | _ => true",
"start": [
54,
1
],
"end": [
59,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isLE",
"code": "def isLE : Ordering → Bool\n | gt => false\n | _ => true",
"start": [
61,
1
],
"end": [
66,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isLT",
"code": "def isLT : Ordering → Bool\n | lt => true\n | _ => false",
"start": [
68,
1
],
"end": [
73,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isGT",
"code": "def isGT : Ordering → Bool\n | gt => true\n | _ => false",
"start": [
75,
1
],
"end": [
80,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Ordering.isGE",
"code": "def isGE : Ordering → Bool\n | lt => false\n | _ => true",
"start": [
82,
1
],
"end": [
87,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "compareOfLessAndEq",
"code": "@[inline] def compareOfLessAndEq {α} (x y : α) [LT α] [Decidable (x < y)] [DecidableEq α] : Ordering :=\n if x < y then Ordering.lt\n else if x = y then Ordering.eq\n else Ordering.gt",
"start": [
91,
1
],
"end": [
98,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "compareOfLessAndBEq",
"code": "@[inline] def compareOfLessAndBEq {α} (x y : α) [LT α] [Decidable (x < y)] [BEq α] : Ordering :=\n if x < y then .lt\n else if x == y then .eq\n else .gt",
"start": [
100,
1
],
"end": [
107,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "compareLex",
"code": "@[inline] def compareLex (cmp₁ cmp₂ : α → β → Ordering) (a : α) (b : β) : Ordering :=\n (cmp₁ a b).then (cmp₂ a b)",
"start": [
109,
1
],
"end": [
115,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord",
"code": "class Ord (α : Type u) where\n \n compare : α → α → Ordering",
"start": [
117,
1
],
"end": [
129,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "compareOn",
"code": "@[inline] def compareOn [ord : Ord β] (f : α → β) (x y : α) : Ordering :=\n compare (f x) (f y)",
"start": [
134,
1
],
"end": [
138,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "lexOrd",
"code": "def lexOrd [Ord α] [Ord β] : Ord (α × β) where\n compare := compareLex (compareOn (·.1)) (compareOn (·.2))",
"start": [
183,
1
],
"end": [
185,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "ltOfOrd",
"code": "def ltOfOrd [Ord α] : LT α where\n lt a b := compare a b = Ordering.lt",
"start": [
187,
1
],
"end": [
188,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "leOfOrd",
"code": "def leOfOrd [Ord α] : LE α where\n le a b := (compare a b).isLE",
"start": [
193,
1
],
"end": [
194,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.toBEq",
"code": "protected def toBEq (ord : Ord α) : BEq α where\n beq x y := ord.compare x y == .eq",
"start": [
201,
1
],
"end": [
205,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.toLT",
"code": "protected def toLT (_ : Ord α) : LT α :=\n ltOfOrd",
"start": [
207,
1
],
"end": [
211,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.toLE",
"code": "protected def toLE (_ : Ord α) : LE α :=\n leOfOrd",
"start": [
213,
1
],
"end": [
217,
10
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.opposite",
"code": "protected def opposite (ord : Ord α) : Ord α where\n compare x y := ord.compare y x",
"start": [
219,
1
],
"end": [
223,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.on",
"code": "protected def on (_ : Ord β) (f : α → β) : Ord α where\n compare := compareOn f",
"start": [
225,
1
],
"end": [
229,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.lex",
"code": "protected def lex (_ : Ord α) (_ : Ord β) : Ord (α × β) :=\n lexOrd",
"start": [
231,
1
],
"end": [
235,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.lex'",
"code": "protected def lex' (ord₁ ord₂ : Ord α) : Ord α where\n compare := compareLex ord₁.compare ord₂.compare",
"start": [
237,
1
],
"end": [
242,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Ord.arrayOrd",
"code": "protected def arrayOrd [a : Ord α] : Ord (Array α) where\n compare x y :=\n let _ : LT α := a.toLT\n let _ : BEq α := a.toBEq\n compareOfLessAndBEq x.toList y.toList",
"start": [
244,
1
],
"end": [
251,
42
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/EState.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/State.lean",
".lake/packages/lean4/src/lean/Init/Control/Except.lean"
] | [
{
"full_name": "EStateM.orElse'",
"code": "@[always_inline, inline]\nprotected def orElse' {δ} [Backtrackable δ σ] (x₁ x₂ : EStateM ε σ α) (useFirstEx := true) : EStateM ε σ α := fun s =>\n let d := Backtrackable.save s;\n match x₁ s with\n | Result.error e₁ s₁ =>\n match x₂ (Backtrackable.restore s₁ d) with\n | Result.error e₂ s₂ => Result.error (if useFirstEx then e₁ else e₂) s₂\n | ok => ok\n | ok => ok",
"start": [
32,
1
],
"end": [
42,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "EStateM.fromStateM",
"code": "@[always_inline, inline] def fromStateM {ε σ α : Type} (x : StateM σ α) : EStateM ε σ α := fun s =>\n match x.run s with\n | (a, s') => EStateM.Result.ok a s'",
"start": [
57,
1
],
"end": [
59,
38
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Control/Reader.lean | [
".lake/packages/lean4/src/lean/Init/Control/Id.lean",
".lake/packages/lean4/src/lean/Init/Control/Basic.lean",
".lake/packages/lean4/src/lean/Init/Control/Except.lean"
] | [
{
"full_name": "ReaderT.orElse",
"code": "@[always_inline, inline]\nprotected def orElse [Alternative m] (x₁ : ReaderT ρ m α) (x₂ : Unit → ReaderT ρ m α) : ReaderT ρ m α :=\n fun s => x₁ s <|> x₂ () s",
"start": [
15,
1
],
"end": [
17,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.failure",
"code": "@[always_inline, inline]\nprotected def failure [Alternative m] : ReaderT ρ m α :=\n fun _ => failure",
"start": [
19,
1
],
"end": [
21,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderT.tryFinally",
"code": "@[always_inline]\ninstance ReaderT.tryFinally [MonadFinally m] : MonadFinally (ReaderT ρ m) where\n tryFinally' x h ctx := tryFinally' (x ctx) (fun a? => h a? ctx)",
"start": [
34,
1
],
"end": [
36,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "ReaderM",
"code": "@[reducible] def ReaderM (ρ : Type u) := ReaderT ρ Id",
"start": [
38,
1
],
"end": [
38,
54
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/System/Platform.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean"
] | [
{
"full_name": "System.Platform.getIsWindows",
"code": "@[extern \"lean_system_platform_windows\"] opaque getIsWindows : Unit → Bool",
"start": [
13,
1
],
"end": [
13,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.getIsOSX",
"code": "@[extern \"lean_system_platform_osx\"] opaque getIsOSX : Unit → Bool",
"start": [
14,
1
],
"end": [
14,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.getIsEmscripten",
"code": "@[extern \"lean_system_platform_emscripten\"] opaque getIsEmscripten : Unit → Bool",
"start": [
15,
1
],
"end": [
15,
81
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.isWindows",
"code": "def isWindows : Bool := getIsWindows ()",
"start": [
17,
1
],
"end": [
17,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.isOSX",
"code": "def isOSX : Bool := getIsOSX ()",
"start": [
18,
1
],
"end": [
18,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.isEmscripten",
"code": "def isEmscripten : Bool := getIsEmscripten ()",
"start": [
19,
1
],
"end": [
19,
46
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.getTarget",
"code": "@[extern \"lean_system_platform_target\"] opaque getTarget : Unit → String",
"start": [
21,
1
],
"end": [
21,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "System.Platform.target",
"code": "def target : String := getTarget ()",
"start": [
23,
1
],
"end": [
24,
36
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/SMap.lean | [
".lake/packages/lean4/src/lean/Lean/Data/PersistentHashMap.lean",
".lake/packages/lean4/src/lean/Lean/Data/HashMap.lean"
] | [
{
"full_name": "Lean.SMap",
"code": "structure SMap (α : Type u) (β : Type v) [BEq α] [Hashable α] where\n stage₁ : Bool := true\n map₁ : HashMap α β := {}\n map₂ : PHashMap α β := {}",
"start": [
13,
1
],
"end": [
32,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.empty",
"code": "def empty : SMap α β := {}",
"start": [
38,
1
],
"end": [
38,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.fromHashMap",
"code": "@[inline] def fromHashMap (m : HashMap α β) (stage₁ := true) : SMap α β :=\n { map₁ := m, stage₁ := stage₁ }",
"start": [
40,
1
],
"end": [
41,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.insert",
"code": "@[specialize] def insert : SMap α β → α → β → SMap α β\n | ⟨true, m₁, m₂⟩, k, v => ⟨true, m₁.insert k v, m₂⟩\n | ⟨false, m₁, m₂⟩, k, v => ⟨false, m₁, m₂.insert k v⟩",
"start": [
43,
1
],
"end": [
45,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.insert'",
"code": "@[specialize] def insert' : SMap α β → α → β → SMap α β\n | ⟨true, m₁, m₂⟩, k, v => ⟨true, m₁.insert k v, m₂⟩\n | ⟨false, m₁, m₂⟩, k, v => ⟨false, m₁, m₂.insert k v⟩",
"start": [
47,
1
],
"end": [
49,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.find?",
"code": "@[specialize] def find? : SMap α β → α → Option β\n | ⟨true, m₁, _⟩, k => m₁.find? k\n | ⟨false, m₁, m₂⟩, k => (m₂.find? k).orElse fun _ => m₁.find? k",
"start": [
51,
1
],
"end": [
53,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.findD",
"code": "@[inline] def findD (m : SMap α β) (a : α) (b₀ : β) : β :=\n (m.find? a).getD b₀",
"start": [
55,
1
],
"end": [
56,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.find!",
"code": "@[inline] def find! [Inhabited β] (m : SMap α β) (a : α) : β :=\n match m.find? a with\n | some b => b\n | none => panic! \"key is not in the map\"",
"start": [
58,
1
],
"end": [
61,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.contains",
"code": "@[specialize] def contains : SMap α β → α → Bool\n | ⟨true, m₁, _⟩, k => m₁.contains k\n | ⟨false, m₁, m₂⟩, k => m₁.contains k || m₂.contains k",
"start": [
63,
1
],
"end": [
65,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.find?'",
"code": "@[specialize] def find?' : SMap α β → α → Option β\n | ⟨true, m₁, _⟩, k => m₁.find? k\n | ⟨false, m₁, m₂⟩, k => (m₁.find? k).orElse fun _ => m₂.find? k",
"start": [
67,
1
],
"end": [
71,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.forM",
"code": "def forM [Monad m] (s : SMap α β) (f : α → β → m PUnit) : m PUnit := do\n s.map₁.forM f\n s.map₂.forM f",
"start": [
73,
1
],
"end": [
75,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.switch",
"code": "def switch (m : SMap α β) : SMap α β :=\n if m.stage₁ then { m with stage₁ := false } else m",
"start": [
83,
1
],
"end": [
85,
53
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.foldStage2",
"code": "@[inline] def foldStage2 {σ : Type w} (f : σ → α → β → σ) (s : σ) (m : SMap α β) : σ :=\n m.map₂.foldl f s",
"start": [
87,
1
],
"end": [
88,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.fold",
"code": "def fold {σ : Type w} (f : σ → α → β → σ) (init : σ) (m : SMap α β) : σ :=\n m.map₂.foldl f $ m.map₁.fold f init",
"start": [
90,
1
],
"end": [
91,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.numBuckets",
"code": "def numBuckets (m : SMap α β) : Nat :=\n m.map₁.numBuckets",
"start": [
93,
1
],
"end": [
94,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SMap.toList",
"code": "def toList (m : SMap α β) : List (α × β) :=\n m.fold (init := []) fun es a b => (a, b)::es",
"start": [
96,
1
],
"end": [
97,
47
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toSMap",
"code": "def _root_.List.toSMap [BEq α] [Hashable α] (es : List (α × β)) : SMap α β :=\n es.foldl (init := {}) fun s (a, b) => s.insert a b",
"start": [
101,
1
],
"end": [
102,
53
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/RBMap.lean | [
".lake/packages/lean4/src/lean/Init/Data/Nat/Linear.lean",
".lake/packages/lean4/src/lean/Init/Data/Ord.lean"
] | [
{
"full_name": "Lean.RBColor",
"code": "inductive RBColor where\n | red | black",
"start": [
13,
1
],
"end": [
14,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode",
"code": "inductive RBNode (α : Type u) (β : α → Type v) where\n | leaf : RBNode α β\n | node (color : RBColor) (lchild : RBNode α β) (key : α) (val : β key) (rchild : RBNode α β) : RBNode α β",
"start": [
16,
1
],
"end": [
18,
109
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.depth",
"code": "def depth (f : Nat → Nat → Nat) : RBNode α β → Nat\n | leaf => 0\n | node _ l _ _ r => succ (f (depth f l) (depth f r))",
"start": [
25,
1
],
"end": [
27,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.min",
"code": "protected def min : RBNode α β → Option (Sigma (fun k => β k))\n | leaf => none\n | node _ leaf k v _ => some ⟨k, v⟩\n | node _ l _ _ _ => RBNode.min l",
"start": [
29,
1
],
"end": [
32,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.max",
"code": "protected def max : RBNode α β → Option (Sigma (fun k => β k))\n | leaf => none\n | node _ _ k v leaf => some ⟨k, v⟩\n | node _ _ _ _ r => RBNode.max r",
"start": [
34,
1
],
"end": [
37,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.fold",
"code": "@[specialize] def fold (f : σ → (k : α) → β k → σ) : (init : σ) → RBNode α β → σ\n | b, leaf => b\n | b, node _ l k v r => fold f (f (fold f b l) k v) r",
"start": [
39,
1
],
"end": [
41,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.forM",
"code": "@[specialize] def forM [Monad m] (f : (k : α) → β k → m Unit) : RBNode α β → m Unit\n | leaf => pure ()\n | node _ l k v r => do forM f l; f k v; forM f r",
"start": [
43,
1
],
"end": [
45,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.foldM",
"code": "@[specialize] def foldM [Monad m] (f : σ → (k : α) → β k → m σ) : (init : σ) → RBNode α β → m σ\n | b, leaf => pure b\n | b, node _ l k v r => do\n let b ← foldM f b l\n let b ← f b k v\n foldM f b r",
"start": [
47,
1
],
"end": [
52,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.forIn",
"code": "@[inline] protected def forIn [Monad m] (as : RBNode α β) (init : σ) (f : (k : α) → β k → σ → m (ForInStep σ)) : m σ := do\n let rec @[specialize] visit : RBNode α β → σ → m (ForInStep σ)\n | leaf, b => return ForInStep.yield b\n | node _ l k v r, b => do\n match (← visit l b) with\n | r@(ForInStep.done _) => return r\n | ForInStep.yield b =>\n match (← f k v b) with\n | r@(ForInStep.done _) => return r\n | ForInStep.yield b => visit r b\n match (← visit as init) with\n | ForInStep.done b => pure b\n | ForInStep.yield b => pure b",
"start": [
54,
1
],
"end": [
66,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.revFold",
"code": "@[specialize] def revFold (f : σ → (k : α) → β k → σ) : (init : σ) → RBNode α β → σ\n | b, leaf => b\n | b, node _ l k v r => revFold f (f (revFold f b r) k v) l",
"start": [
68,
1
],
"end": [
70,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.all",
"code": "@[specialize] def all (p : (k : α) → β k → Bool) : RBNode α β → Bool\n | leaf => true\n | node _ l k v r => p k v && all p l && all p r",
"start": [
72,
1
],
"end": [
74,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.any",
"code": "@[specialize] def any (p : (k : α) → β k → Bool) : RBNode α β → Bool\n | leaf => false\n | node _ l k v r => p k v || any p l || any p r",
"start": [
76,
1
],
"end": [
78,
50
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.singleton",
"code": "def singleton (k : α) (v : β k) : RBNode α β :=\n node red leaf k v leaf",
"start": [
80,
1
],
"end": [
81,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.balance1",
"code": "@[inline] def balance1 : RBNode α β → (a : α) → β a → RBNode α β → RBNode α β\n | node red (node red a kx vx b) ky vy c, kz, vz, d\n | node red a kx vx (node red b ky vy c), kz, vz, d => node red (node black a kx vx b) ky vy (node black c kz vz d)\n | a, kx, vx, b => node black a kx vx b",
"start": [
84,
1
],
"end": [
87,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.balance2",
"code": "@[inline] def balance2 : RBNode α β → (a : α) → β a → RBNode α β → RBNode α β\n | a, kx, vx, node red (node red b ky vy c) kz vz d\n | a, kx, vx, node red b ky vy (node red c kz vz d) => node red (node black a kx vx b) ky vy (node black c kz vz d)\n | a, kx, vx, b => node black a kx vx b",
"start": [
90,
1
],
"end": [
93,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.isRed",
"code": "def isRed : RBNode α β → Bool\n | node red .. => true\n | _ => false",
"start": [
95,
1
],
"end": [
97,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.isBlack",
"code": "def isBlack : RBNode α β → Bool\n | node black .. => true\n | _ => false",
"start": [
99,
1
],
"end": [
101,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.ins",
"code": "@[specialize] def ins : RBNode α β → (k : α) → β k → RBNode α β\n | leaf, kx, vx => node red leaf kx vx leaf\n | node red a ky vy b, kx, vx =>\n match cmp kx ky with\n | Ordering.lt => node red (ins a kx vx) ky vy b\n | Ordering.gt => node red a ky vy (ins b kx vx)\n | Ordering.eq => node red a kx vx b\n | node black a ky vy b, kx, vx =>\n match cmp kx ky with\n | Ordering.lt => balance1 (ins a kx vx) ky vy b\n | Ordering.gt => balance2 a ky vy (ins b kx vx)\n | Ordering.eq => node black a kx vx b",
"start": [
107,
1
],
"end": [
118,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.setBlack",
"code": "def setBlack : RBNode α β → RBNode α β\n | node _ l k v r => node black l k v r\n | e => e",
"start": [
120,
1
],
"end": [
122,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.insert",
"code": "@[specialize] def insert (t : RBNode α β) (k : α) (v : β k) : RBNode α β :=\n if isRed t then setBlack (ins cmp t k v)\n else ins cmp t k v",
"start": [
124,
1
],
"end": [
126,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.setRed",
"code": "def setRed : RBNode α β → RBNode α β\n | node _ a k v b => node red a k v b\n | e => e",
"start": [
130,
1
],
"end": [
132,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.balLeft",
"code": "def balLeft : RBNode α β → (k : α) → β k → RBNode α β → RBNode α β\n | node red a kx vx b, k, v, r => node red (node black a kx vx b) k v r\n | l, k, v, node black a ky vy b => balance2 l k v (node red a ky vy b)\n | l, k, v, node red (node black a ky vy b) kz vz c => node red (node black l k v a) ky vy (balance2 b kz vz (setRed c))\n | l, k, v, r => node red l k v r",
"start": [
134,
1
],
"end": [
138,
73
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.balRight",
"code": "def balRight (l : RBNode α β) (k : α) (v : β k) (r : RBNode α β) : RBNode α β :=\n match r with\n | (node red b ky vy c) => node red l k v (node black b ky vy c)\n | _ => match l with\n | node black a kx vx b => balance1 (node red a kx vx b) k v r\n | node red a kx vx (node black b ky vy c) => node red (balance1 (setRed a) kx vx b) ky vy (node black c k v r)\n | _ => node red l k v r",
"start": [
140,
1
],
"end": [
146,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.size",
"code": "@[local simp] def size : RBNode α β → Nat\n | leaf => 0\n | node _ x _ _ y => x.size + y.size + 1",
"start": [
148,
1
],
"end": [
151,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.appendTrees",
"code": "def appendTrees : RBNode α β → RBNode α β → RBNode α β\n | leaf, x => x\n | x, leaf => x\n | node red a kx vx b, node red c ky vy d =>\n match appendTrees b c with\n | node red b' kz vz c' => node red (node red a kx vx b') kz vz (node red c' ky vy d)\n | bc => node red a kx vx (node red bc ky vy d)\n | node black a kx vx b, node black c ky vy d =>\n match appendTrees b c with\n | node red b' kz vz c' => node red (node black a kx vx b') kz vz (node black c' ky vy d)\n | bc => balLeft a kx vx (node black bc ky vy d)\n | a, node red b kx vx c => node red (appendTrees a b) kx vx c\n | node red a kx vx b, c => node red a kx vx (appendTrees b c)\ntermination_by x y => x.size + y.size",
"start": [
153,
1
],
"end": [
166,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.del",
"code": "@[specialize] def del (x : α) : RBNode α β → RBNode α β\n | leaf => leaf\n | node _ a y v b =>\n match cmp x y with\n | Ordering.lt =>\n if a.isBlack then balLeft (del x a) y v b\n else node red (del x a) y v b\n | Ordering.gt =>\n if b.isBlack then balRight a y v (del x b)\n else node red a y v (del x b)\n | Ordering.eq => appendTrees a b",
"start": [
172,
1
],
"end": [
182,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.erase",
"code": "@[specialize] def erase (x : α) (t : RBNode α β) : RBNode α β :=\n let t := del cmp x t;\n t.setBlack",
"start": [
184,
1
],
"end": [
186,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.findCore",
"code": "@[specialize] def findCore : RBNode α β → (k : α) → Option (Sigma (fun k => β k))\n | leaf, _ => none\n | node _ a ky vy b, x =>\n match cmp x ky with\n | Ordering.lt => findCore a x\n | Ordering.gt => findCore b x\n | Ordering.eq => some ⟨ky, vy⟩",
"start": [
193,
1
],
"end": [
199,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.find",
"code": "@[specialize] def find {β : Type v} : RBNode α (fun _ => β) → α → Option β\n | leaf, _ => none\n | node _ a ky vy b, x =>\n match cmp x ky with\n | Ordering.lt => find a x\n | Ordering.gt => find b x\n | Ordering.eq => some vy",
"start": [
201,
1
],
"end": [
207,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.lowerBound",
"code": "@[specialize] def lowerBound : RBNode α β → α → Option (Sigma β) → Option (Sigma β)\n | leaf, _, lb => lb\n | node _ a ky vy b, x, lb =>\n match cmp x ky with\n | Ordering.lt => lowerBound a x lb\n | Ordering.gt => lowerBound b x (some ⟨ky, vy⟩)\n | Ordering.eq => some ⟨ky, vy⟩",
"start": [
209,
1
],
"end": [
215,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.WellFormed",
"code": "inductive WellFormed (cmp : α → α → Ordering) : RBNode α β → Prop where\n | leafWff : WellFormed cmp leaf\n | insertWff {n n' : RBNode α β} {k : α} {v : β k} : WellFormed cmp n → n' = insert cmp n k v → WellFormed cmp n'\n | eraseWff {n n' : RBNode α β} {k : α} : WellFormed cmp n → n' = erase cmp k n → WellFormed cmp n'",
"start": [
219,
1
],
"end": [
222,
101
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.mapM",
"code": "@[specialize] def mapM {α : Type v} {β γ : α → Type v} {M : Type v → Type v} [Applicative M]\n (f : (a : α) → β a → M (γ a))\n : RBNode α β → M (RBNode α γ)\n | leaf => pure leaf\n | node color lchild key val rchild =>\n pure (node color · key · ·) <*> lchild.mapM f <*> f _ val <*> rchild.mapM f",
"start": [
226,
1
],
"end": [
231,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.map",
"code": "@[specialize] def map {α : Type u} {β γ : α → Type v}\n (f : (a : α) → β a → γ a)\n : RBNode α β → RBNode α γ\n | leaf => leaf\n | node color lchild key val rchild => node color (lchild.map f) key (f key val) (rchild.map f)",
"start": [
233,
1
],
"end": [
237,
97
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBNode.toArray",
"code": "def toArray (n : RBNode α β) : Array (Sigma β) :=\n n.fold (init := ∅) fun acc k v => acc.push ⟨k,v⟩",
"start": [
241,
1
],
"end": [
242,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap",
"code": "def RBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) : Type (max u v) :=\n {t : RBNode α (fun _ => β) // t.WellFormed cmp }",
"start": [
252,
1
],
"end": [
253,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkRBMap",
"code": "@[inline] def mkRBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) : RBMap α β cmp :=\n ⟨leaf, WellFormed.leafWff⟩",
"start": [
255,
1
],
"end": [
256,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.empty",
"code": "@[inline] def RBMap.empty {α : Type u} {β : Type v} {cmp : α → α → Ordering} : RBMap α β cmp :=\n mkRBMap ..",
"start": [
258,
1
],
"end": [
259,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.depth",
"code": "def depth (f : Nat → Nat → Nat) (t : RBMap α β cmp) : Nat :=\n t.val.depth f",
"start": [
269,
1
],
"end": [
270,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.fold",
"code": "@[inline] def fold (f : σ → α → β → σ) : (init : σ) → RBMap α β cmp → σ\n | b, ⟨t, _⟩ => t.fold f b",
"start": [
272,
1
],
"end": [
273,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.revFold",
"code": "@[inline] def revFold (f : σ → α → β → σ) : (init : σ) → RBMap α β cmp → σ\n | b, ⟨t, _⟩ => t.revFold f b",
"start": [
275,
1
],
"end": [
276,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.foldM",
"code": "@[inline] def foldM [Monad m] (f : σ → α → β → m σ) : (init : σ) → RBMap α β cmp → m σ\n | b, ⟨t, _⟩ => t.foldM f b",
"start": [
278,
1
],
"end": [
279,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.forM",
"code": "@[inline] def forM [Monad m] (f : α → β → m PUnit) (t : RBMap α β cmp) : m PUnit :=\n t.foldM (fun _ k v => f k v) ⟨⟩",
"start": [
281,
1
],
"end": [
282,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.forIn",
"code": "@[inline] protected def forIn [Monad m] (t : RBMap α β cmp) (init : σ) (f : (α × β) → σ → m (ForInStep σ)) : m σ :=\n t.val.forIn init (fun a b acc => f (a, b) acc)",
"start": [
284,
1
],
"end": [
285,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.isEmpty",
"code": "@[inline] def isEmpty : RBMap α β cmp → Bool\n | ⟨leaf, _⟩ => true\n | _ => false",
"start": [
290,
1
],
"end": [
292,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.toList",
"code": "@[specialize] def toList : RBMap α β cmp → List (α × β)\n | ⟨t, _⟩ => t.revFold (fun ps k v => (k, v)::ps) []",
"start": [
294,
1
],
"end": [
295,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.min",
"code": "@[inline] protected def min : RBMap α β cmp → Option (α × β)\n | ⟨t, _⟩ =>\n match t.min with\n | some ⟨k, v⟩ => some (k, v)\n | none => none",
"start": [
297,
1
],
"end": [
302,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.max",
"code": "@[inline] protected def max : RBMap α β cmp → Option (α × β)\n | ⟨t, _⟩ =>\n match t.max with\n | some ⟨k, v⟩ => some (k, v)\n | none => none",
"start": [
304,
1
],
"end": [
309,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.insert",
"code": "@[inline] def insert : RBMap α β cmp → α → β → RBMap α β cmp\n | ⟨t, w⟩, k, v => ⟨t.insert cmp k v, WellFormed.insertWff w rfl⟩",
"start": [
314,
1
],
"end": [
315,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.erase",
"code": "@[inline] def erase : RBMap α β cmp → α → RBMap α β cmp\n | ⟨t, w⟩, k => ⟨t.erase cmp k, WellFormed.eraseWff w rfl⟩",
"start": [
317,
1
],
"end": [
318,
60
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.ofList",
"code": "@[specialize] def ofList : List (α × β) → RBMap α β cmp\n | [] => mkRBMap ..\n | ⟨k,v⟩::xs => (ofList xs).insert k v",
"start": [
320,
1
],
"end": [
322,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.findCore?",
"code": "@[inline] def findCore? : RBMap α β cmp → α → Option (Sigma (fun (_ : α) => β))\n | ⟨t, _⟩, x => t.findCore cmp x",
"start": [
324,
1
],
"end": [
325,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.find?",
"code": "@[inline] def find? : RBMap α β cmp → α → Option β\n | ⟨t, _⟩, x => t.find cmp x",
"start": [
327,
1
],
"end": [
328,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.findD",
"code": "@[inline] def findD (t : RBMap α β cmp) (k : α) (v₀ : β) : β :=\n (t.find? k).getD v₀",
"start": [
330,
1
],
"end": [
331,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.lowerBound",
"code": "@[inline] def lowerBound : RBMap α β cmp → α → Option (Sigma (fun (_ : α) => β))\n | ⟨t, _⟩, x => t.lowerBound cmp x none",
"start": [
333,
1
],
"end": [
336,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.contains",
"code": "@[inline] def contains (t : RBMap α β cmp) (a : α) : Bool :=\n (t.find? a).isSome",
"start": [
338,
1
],
"end": [
340,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.fromList",
"code": "@[inline] def fromList (l : List (α × β)) (cmp : α → α → Ordering) : RBMap α β cmp :=\n l.foldl (fun r p => r.insert p.1 p.2) (mkRBMap α β cmp)",
"start": [
342,
1
],
"end": [
343,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.fromArray",
"code": "@[inline] def fromArray (l : Array (α × β)) (cmp : α → α → Ordering) : RBMap α β cmp :=\n l.foldl (fun r p => r.insert p.1 p.2) (mkRBMap α β cmp)",
"start": [
345,
1
],
"end": [
346,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.all",
"code": "@[inline] def all : RBMap α β cmp → (α → β → Bool) → Bool\n | ⟨t, _⟩, p => t.all p",
"start": [
348,
1
],
"end": [
350,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.any",
"code": "@[inline] def any : RBMap α β cmp → (α → β → Bool) → Bool\n | ⟨t, _⟩, p => t.any p",
"start": [
352,
1
],
"end": [
354,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.size",
"code": "def size (m : RBMap α β cmp) : Nat :=\n m.fold (fun sz _ _ => sz+1) 0",
"start": [
356,
1
],
"end": [
358,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.maxDepth",
"code": "def maxDepth (t : RBMap α β cmp) : Nat :=\n t.val.depth Nat.max",
"start": [
360,
1
],
"end": [
361,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.min!",
"code": "@[inline] def min! [Inhabited α] [Inhabited β] (t : RBMap α β cmp) : α × β :=\n match t.min with\n | some p => p\n | none => panic! \"map is empty\"",
"start": [
363,
1
],
"end": [
366,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.max!",
"code": "@[inline] def max! [Inhabited α] [Inhabited β] (t : RBMap α β cmp) : α × β :=\n match t.max with\n | some p => p\n | none => panic! \"map is empty\"",
"start": [
368,
1
],
"end": [
371,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.find!",
"code": "@[inline] def find! [Inhabited β] (t : RBMap α β cmp) (k : α) : β :=\n match t.find? k with\n | some b => b\n | none => panic! \"key is not in the map\"",
"start": [
373,
1
],
"end": [
377,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.mergeBy",
"code": "def mergeBy (mergeFn : α → β → β → β) (t₁ t₂ : RBMap α β cmp) : RBMap α β cmp :=\n t₂.fold (init := t₁) fun t₁ a b₂ =>\n t₁.insert a <|\n match t₁.find? a with\n | some b₁ => mergeFn a b₁ b₂\n | none => b₂",
"start": [
379,
1
],
"end": [
386,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBMap.intersectBy",
"code": "def intersectBy {γ : Type v₁} {δ : Type v₂} (mergeFn : α → β → γ → δ) (t₁ : RBMap α β cmp) (t₂ : RBMap α γ cmp) : RBMap α δ cmp :=\n t₁.fold (init := ∅) fun acc a b₁ =>\n match t₂.find? a with\n | some b₂ => acc.insert a <| mergeFn a b₁ b₂\n | none => acc",
"start": [
388,
1
],
"end": [
393,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.rbmapOf",
"code": "def rbmapOf {α : Type u} {β : Type v} (l : List (α × β)) (cmp : α → α → Ordering) : RBMap α β cmp :=\n RBMap.fromList l cmp",
"start": [
397,
1
],
"end": [
398,
23
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/System/ST.lean | [
".lake/packages/lean4/src/lean/Init/Control/Reader.lean",
".lake/packages/lean4/src/lean/Init/Classical.lean",
".lake/packages/lean4/src/lean/Init/Control/EState.lean"
] | [
{
"full_name": "EST",
"code": "def EST (ε : Type) (σ : Type) : Type → Type := EStateM ε σ",
"start": [
11,
1
],
"end": [
11,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "ST",
"code": "abbrev ST (σ : Type) := EST Empty σ",
"start": [
12,
1
],
"end": [
12,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "STWorld",
"code": "class STWorld (σ : outParam Type) (m : Type → Type)",
"start": [
20,
1
],
"end": [
20,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "runEST",
"code": "@[noinline, nospecialize]\ndef runEST {ε α : Type} (x : (σ : Type) → EST ε σ α) : Except ε α :=\n match x Unit () with\n | EStateM.Result.ok a _ => Except.ok a\n | EStateM.Result.error ex _ => Except.error ex",
"start": [
25,
1
],
"end": [
29,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "runST",
"code": "@[noinline, nospecialize]\ndef runST {α : Type} (x : (σ : Type) → ST σ α) : α :=\n match x Unit () with\n | EStateM.Result.ok a _ => a\n | EStateM.Result.error ex _ => nomatch ex",
"start": [
31,
1
],
"end": [
35,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.RefPointed",
"code": "opaque RefPointed : NonemptyType.{0}",
"start": [
45,
1
],
"end": [
46,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref",
"code": "structure Ref (σ : Type) (α : Type) : Type where\n ref : RefPointed.type\n h : Nonempty α",
"start": [
48,
1
],
"end": [
50,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.inhabitedFromRef",
"code": "private noncomputable def inhabitedFromRef {σ α} (r : Ref σ α) : ST σ α :=\n let _ : Inhabited α := Classical.inhabited_of_nonempty r.h\n pure default",
"start": [
57,
1
],
"end": [
60,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.mkRef",
"code": "@[extern \"lean_st_mk_ref\"]\nopaque mkRef {σ α} (a : α) : ST σ (Ref σ α) := pure { ref := Classical.choice RefPointed.property, h := Nonempty.intro a }",
"start": [
62,
1
],
"end": [
63,
123
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.get",
"code": "@[extern \"lean_st_ref_get\"]\nopaque Ref.get {σ α} (r : @& Ref σ α) : ST σ α := inhabitedFromRef r",
"start": [
64,
1
],
"end": [
65,
69
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.set",
"code": "@[extern \"lean_st_ref_set\"]\nopaque Ref.set {σ α} (r : @& Ref σ α) (a : α) : ST σ Unit",
"start": [
66,
1
],
"end": [
67,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.swap",
"code": "@[extern \"lean_st_ref_swap\"]\nopaque Ref.swap {σ α} (r : @& Ref σ α) (a : α) : ST σ α := inhabitedFromRef r",
"start": [
68,
1
],
"end": [
69,
78
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.take",
"code": "@[extern \"lean_st_ref_take\"]\nunsafe opaque Ref.take {σ α} (r : @& Ref σ α) : ST σ α := inhabitedFromRef r",
"start": [
70,
1
],
"end": [
71,
77
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.ptrEq",
"code": "@[extern \"lean_st_ref_ptr_eq\"]\nopaque Ref.ptrEq {σ α} (r1 r2 : @& Ref σ α) : ST σ Bool",
"start": [
72,
1
],
"end": [
73,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.modifyUnsafe",
"code": "@[inline] unsafe def Ref.modifyUnsafe {σ α : Type} (r : Ref σ α) (f : α → α) : ST σ Unit := do\n let v ← Ref.take r\n Ref.set r (f v)",
"start": [
75,
1
],
"end": [
77,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.modifyGetUnsafe",
"code": "@[inline] unsafe def Ref.modifyGetUnsafe {σ α β : Type} (r : Ref σ α) (f : α → β × α) : ST σ β := do\n let v ← Ref.take r\n let (b, a) := f v\n Ref.set r a\n pure b",
"start": [
79,
1
],
"end": [
83,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.modify",
"code": "@[implemented_by Ref.modifyUnsafe]\ndef Ref.modify {σ α : Type} (r : Ref σ α) (f : α → α) : ST σ Unit := do\n let v ← Ref.get r\n Ref.set r (f v)",
"start": [
85,
1
],
"end": [
88,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Prim.Ref.modifyGet",
"code": "@[implemented_by Ref.modifyGetUnsafe]\ndef Ref.modifyGet {σ α β : Type} (r : Ref σ α) (f : α → β × α) : ST σ β := do\n let v ← Ref.get r\n let (b, a) := f v\n Ref.set r a\n pure b",
"start": [
90,
1
],
"end": [
95,
9
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.mkRef",
"code": "@[inline] def mkRef {α : Type} (a : α) : m (Ref σ α) := liftM <| Prim.mkRef a",
"start": [
102,
1
],
"end": [
102,
79
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.get",
"code": "@[inline] def Ref.get {α : Type} (r : Ref σ α) : m α := liftM <| Prim.Ref.get r",
"start": [
103,
1
],
"end": [
103,
80
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.set",
"code": "@[inline] def Ref.set {α : Type} (r : Ref σ α) (a : α) : m Unit := liftM <| Prim.Ref.set r a",
"start": [
104,
1
],
"end": [
104,
93
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.swap",
"code": "@[inline] def Ref.swap {α : Type} (r : Ref σ α) (a : α) : m α := liftM <| Prim.Ref.swap r a",
"start": [
105,
1
],
"end": [
105,
92
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.take",
"code": "@[inline] unsafe def Ref.take {α : Type} (r : Ref σ α) : m α := liftM <| Prim.Ref.take r",
"start": [
106,
1
],
"end": [
106,
89
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.ptrEq",
"code": "@[inline] def Ref.ptrEq {α : Type} (r1 r2 : Ref σ α) : m Bool := liftM <| Prim.Ref.ptrEq r1 r2",
"start": [
107,
1
],
"end": [
107,
95
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.modify",
"code": "@[inline] def Ref.modify {α : Type} (r : Ref σ α) (f : α → α) : m Unit := liftM <| Prim.Ref.modify r f",
"start": [
108,
1
],
"end": [
108,
103
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.modifyGet",
"code": "@[inline] def Ref.modifyGet {α : Type} {β : Type} (r : Ref σ α) (f : α → β × α) : m β := liftM <| Prim.Ref.modifyGet r f",
"start": [
109,
1
],
"end": [
109,
121
],
"kind": "commanddeclaration"
},
{
"full_name": "ST.Ref.toMonadStateOf",
"code": "def Ref.toMonadStateOf (r : Ref σ α) : MonadStateOf α m where\n get := r.get\n set := r.set\n modifyGet := r.modifyGet",
"start": [
111,
1
],
"end": [
114,
27
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/System/FilePath.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/System/Platform.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Repr.lean"
] | [
{
"full_name": "System.FilePath",
"code": "structure FilePath where\n toString : String\n deriving Inhabited, DecidableEq, Hashable",
"start": [
15,
1
],
"end": [
17,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.pathSeparator",
"code": "def pathSeparator : Char :=\n if isWindows then '\\\\' else '/'",
"start": [
27,
1
],
"end": [
29,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.pathSeparators",
"code": "def pathSeparators : List Char :=\n if isWindows then ['\\\\', '/'] else ['/']",
"start": [
31,
1
],
"end": [
33,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.extSeparator",
"code": "def extSeparator : Char := '.'",
"start": [
35,
1
],
"end": [
36,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.exeExtension",
"code": "def exeExtension : String :=\n if isWindows then \"exe\" else \"\"",
"start": [
38,
1
],
"end": [
39,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.normalize",
"code": "def normalize (p : FilePath) : FilePath := Id.run do\n let mut p := p\n if isWindows && p.toString.length >= 2 && (p.toString.get 0).isLower && p.toString.get ⟨1⟩ == ':' then\n p := ⟨p.toString.set 0 (p.toString.get 0).toUpper⟩\n unless pathSeparators.length == 1 do\n p := ⟨p.toString.map fun c => if pathSeparators.contains c then pathSeparator else c⟩\n return p",
"start": [
42,
1
],
"end": [
50,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.isAbsolute",
"code": "def isAbsolute (p : FilePath) : Bool :=\n pathSeparators.contains p.toString.front || (isWindows && p.toString.length > 1 && p.toString.iter.next.curr == ':')",
"start": [
54,
1
],
"end": [
55,
119
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.isRelative",
"code": "def isRelative (p : FilePath) : Bool :=\n !p.isAbsolute",
"start": [
57,
1
],
"end": [
58,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.join",
"code": "def join (p sub : FilePath) : FilePath :=\n if sub.isAbsolute then\n sub\n else\n ⟨p.toString ++ pathSeparator.toString ++ sub.toString⟩",
"start": [
60,
1
],
"end": [
64,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.posOfLastSep",
"code": "private def posOfLastSep (p : FilePath) : Option String.Pos :=\n p.toString.revFind pathSeparators.contains",
"start": [
72,
1
],
"end": [
73,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.parent",
"code": "def parent (p : FilePath) : Option FilePath :=\n let extractParentPath := FilePath.mk <$> p.toString.extract {} <$> posOfLastSep p\n if p.isAbsolute then\n let lengthOfRootDirectory := if pathSeparators.contains p.toString.front then 1 else 3\n if p.toString.length == lengthOfRootDirectory then\n none\n else if posOfLastSep p == String.Pos.mk (lengthOfRootDirectory - 1) then\n some ⟨p.toString.extract 0 ⟨lengthOfRootDirectory⟩⟩\n else\n extractParentPath\n else\n extractParentPath",
"start": [
75,
1
],
"end": [
90,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.fileName",
"code": "def fileName (p : FilePath) : Option String :=\n let lastPart := match posOfLastSep p with\n | some sepPos => p.toString.extract (sepPos + '/') p.toString.endPos\n | none => p.toString\n if lastPart.isEmpty || lastPart == \".\" || lastPart == \"..\" then none else some lastPart",
"start": [
92,
1
],
"end": [
96,
90
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.fileStem",
"code": "def fileStem (p : FilePath) : Option String :=\n p.fileName.map fun fname =>\n match fname.revPosOf '.' with\n | some ⟨0⟩ => fname\n | some pos => fname.extract 0 pos\n | none => fname",
"start": [
98,
1
],
"end": [
104,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.extension",
"code": "def extension (p : FilePath) : Option String :=\n p.fileName.bind fun fname =>\n match fname.revPosOf '.' with\n | some 0 => none\n | some pos => fname.extract (pos + '.') fname.endPos\n | none => none",
"start": [
106,
1
],
"end": [
111,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.withFileName",
"code": "def withFileName (p : FilePath) (fname : String) : FilePath :=\n match p.parent with\n | none => ⟨fname⟩\n | some p => p / fname",
"start": [
113,
1
],
"end": [
116,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.addExtension",
"code": "def addExtension (p : FilePath) (ext : String) : FilePath :=\n match p.fileName with\n | none => p\n | some fname => p.withFileName (if ext.isEmpty then fname else fname ++ \".\" ++ ext)",
"start": [
118,
1
],
"end": [
127,
86
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.withExtension",
"code": "def withExtension (p : FilePath) (ext : String) : FilePath :=\n match p.fileStem with\n | none => p\n | some stem => p.withFileName (if ext.isEmpty then stem else stem ++ \".\" ++ ext)",
"start": [
129,
1
],
"end": [
136,
83
],
"kind": "commanddeclaration"
},
{
"full_name": "System.FilePath.components",
"code": "def components (p : FilePath) : List String :=\n p.normalize |>.toString.splitOn pathSeparator.toString",
"start": [
138,
1
],
"end": [
139,
57
],
"kind": "commanddeclaration"
},
{
"full_name": "System.mkFilePath",
"code": "def mkFilePath (parts : List String) : FilePath :=\n ⟨String.intercalate FilePath.pathSeparator.toString parts⟩",
"start": [
143,
1
],
"end": [
144,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "System.SearchPath",
"code": "abbrev SearchPath := List FilePath",
"start": [
149,
1
],
"end": [
149,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "System.SearchPath.separator",
"code": "protected def separator : Char :=\n if isWindows then ';' else ':'",
"start": [
153,
1
],
"end": [
155,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "System.SearchPath.parse",
"code": "def parse (s : String) : SearchPath :=\n s.split (fun c => SearchPath.separator == c) |>.map FilePath.mk",
"start": [
157,
1
],
"end": [
158,
66
],
"kind": "commanddeclaration"
},
{
"full_name": "System.SearchPath.toString",
"code": "def toString (path : SearchPath) : String :=\n SearchPath.separator.toString.intercalate (path.map FilePath.toString)",
"start": [
160,
1
],
"end": [
161,
73
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/System/IOError.lean | [
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/UInt/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/String/Basic.lean",
".lake/packages/lean4/src/lean/Init/Core.lean"
] | [
{
"full_name": "IO.Error",
"code": "inductive IO.Error where\n | alreadyExists (filename : Option String) (osCode : UInt32) (details : String) | otherError (osCode : UInt32) (details : String) | resourceBusy (osCode : UInt32) (details : String)\n | resourceVanished (osCode : UInt32) (details : String)\n | unsupportedOperation (osCode : UInt32) (details : String)\n | hardwareFault (osCode : UInt32) (details : String) | unsatisfiedConstraints (osCode : UInt32) (details : String) | illegalOperation (osCode : UInt32) (details : String) | protocolError (osCode : UInt32) (details : String)\n | timeExpired (osCode : UInt32) (details : String)\n | interrupted (filename : String) (osCode : UInt32) (details : String) | noFileOrDirectory (filename : String) (osCode : UInt32) (details : String) | invalidArgument (filename : Option String) (osCode : UInt32) (details : String)\n | permissionDenied (filename : Option String) (osCode : UInt32) (details : String)\n | resourceExhausted (filename : Option String) (osCode : UInt32) (details : String)\n | inappropriateType (filename : Option String) (osCode : UInt32) (details : String)\n | noSuchThing (filename : Option String) (osCode : UInt32) (details : String)\n | unexpectedEof\n | userError (msg : String)\n deriving Inhabited",
"start": [
13,
1
],
"end": [
54,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.userError",
"code": "@[export lean_mk_io_user_error]\ndef IO.userError (s : String) : IO.Error :=\n IO.Error.userError s",
"start": [
56,
1
],
"end": [
58,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkAlreadyExistsFile",
"code": "@[export lean_mk_io_error_already_exists_file]\ndef mkAlreadyExistsFile : String → UInt32 → String → IO.Error :=\n alreadyExists ∘ some",
"start": [
64,
1
],
"end": [
66,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkEofError",
"code": "@[export lean_mk_io_error_eof]\ndef mkEofError : Unit → IO.Error := fun _ =>\n unexpectedEof",
"start": [
68,
1
],
"end": [
70,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkInappropriateTypeFile",
"code": "@[export lean_mk_io_error_inappropriate_type_file]\ndef mkInappropriateTypeFile : String → UInt32 → String → IO.Error :=\n inappropriateType ∘ some",
"start": [
72,
1
],
"end": [
74,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkInterrupted",
"code": "@[export lean_mk_io_error_interrupted]\ndef mkInterrupted : String → UInt32 → String → IO.Error :=\n interrupted",
"start": [
76,
1
],
"end": [
78,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkInvalidArgumentFile",
"code": "@[export lean_mk_io_error_invalid_argument_file]\ndef mkInvalidArgumentFile : String → UInt32 → String → IO.Error :=\n invalidArgument ∘ some",
"start": [
80,
1
],
"end": [
82,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkNoFileOrDirectory",
"code": "@[export lean_mk_io_error_no_file_or_directory]\ndef mkNoFileOrDirectory : String → UInt32 → String → IO.Error :=\n noFileOrDirectory",
"start": [
84,
1
],
"end": [
86,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkNoSuchThingFile",
"code": "@[export lean_mk_io_error_no_such_thing_file]\ndef mkNoSuchThingFile : String → UInt32 → String → IO.Error :=\n noSuchThing ∘ some",
"start": [
88,
1
],
"end": [
90,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkPermissionDeniedFile",
"code": "@[export lean_mk_io_error_permission_denied_file]\ndef mkPermissionDeniedFile : String → UInt32 → String → IO.Error :=\n permissionDenied ∘ some",
"start": [
92,
1
],
"end": [
94,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkResourceExhaustedFile",
"code": "@[export lean_mk_io_error_resource_exhausted_file]\ndef mkResourceExhaustedFile : String → UInt32 → String → IO.Error :=\n resourceExhausted ∘ some",
"start": [
96,
1
],
"end": [
98,
27
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkUnsupportedOperation",
"code": "@[export lean_mk_io_error_unsupported_operation]\ndef mkUnsupportedOperation : UInt32 → String → IO.Error :=\n unsupportedOperation",
"start": [
100,
1
],
"end": [
102,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkResourceExhausted",
"code": "@[export lean_mk_io_error_resource_exhausted]\ndef mkResourceExhausted : UInt32 → String → IO.Error :=\n resourceExhausted none",
"start": [
104,
1
],
"end": [
106,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkAlreadyExists",
"code": "@[export lean_mk_io_error_already_exists]\ndef mkAlreadyExists : UInt32 → String → IO.Error :=\n alreadyExists none",
"start": [
108,
1
],
"end": [
110,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkInappropriateType",
"code": "@[export lean_mk_io_error_inappropriate_type]\ndef mkInappropriateType : UInt32 → String → IO.Error :=\n inappropriateType none",
"start": [
112,
1
],
"end": [
114,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkNoSuchThing",
"code": "@[export lean_mk_io_error_no_such_thing]\ndef mkNoSuchThing : UInt32 → String → IO.Error :=\n noSuchThing none",
"start": [
116,
1
],
"end": [
118,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkResourceVanished",
"code": "@[export lean_mk_io_error_resource_vanished]\ndef mkResourceVanished : UInt32 → String → IO.Error :=\n resourceVanished",
"start": [
120,
1
],
"end": [
122,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkResourceBusy",
"code": "@[export lean_mk_io_error_resource_busy]\ndef mkResourceBusy : UInt32 → String → IO.Error :=\n resourceBusy",
"start": [
124,
1
],
"end": [
126,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkInvalidArgument",
"code": "@[export lean_mk_io_error_invalid_argument]\ndef mkInvalidArgument : UInt32 → String → IO.Error :=\n invalidArgument none",
"start": [
128,
1
],
"end": [
130,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkOtherError",
"code": "@[export lean_mk_io_error_other_error]\ndef mkOtherError : UInt32 → String → IO.Error :=\n otherError",
"start": [
132,
1
],
"end": [
134,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkPermissionDenied",
"code": "@[export lean_mk_io_error_permission_denied]\ndef mkPermissionDenied : UInt32 → String → IO.Error :=\n permissionDenied none",
"start": [
136,
1
],
"end": [
138,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkHardwareFault",
"code": "@[export lean_mk_io_error_hardware_fault]\ndef mkHardwareFault : UInt32 → String → IO.Error :=\n hardwareFault",
"start": [
140,
1
],
"end": [
142,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkUnsatisfiedConstraints",
"code": "@[export lean_mk_io_error_unsatisfied_constraints]\ndef mkUnsatisfiedConstraints : UInt32 → String → IO.Error :=\n unsatisfiedConstraints",
"start": [
144,
1
],
"end": [
146,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkIllegalOperation",
"code": "@[export lean_mk_io_error_illegal_operation]\ndef mkIllegalOperation : UInt32 → String → IO.Error :=\n illegalOperation",
"start": [
148,
1
],
"end": [
150,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkProtocolError",
"code": "@[export lean_mk_io_error_protocol_error]\ndef mkProtocolError : UInt32 → String → IO.Error :=\n protocolError",
"start": [
152,
1
],
"end": [
154,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.mkTimeExpired",
"code": "@[export lean_mk_io_error_time_expired]\ndef mkTimeExpired : UInt32 → String → IO.Error :=\n timeExpired",
"start": [
156,
1
],
"end": [
158,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.downCaseFirst",
"code": "private def downCaseFirst (s : String) : String := s.modify 0 Char.toLower",
"start": [
160,
1
],
"end": [
160,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.fopenErrorToString",
"code": "def fopenErrorToString (gist fn : String) (code : UInt32) : Option String → String\n | some details => downCaseFirst gist ++ \" (error code: \" ++ toString code ++ \", \" ++ downCaseFirst details ++ \")\\n file: \" ++ fn\n | none => downCaseFirst gist ++ \" (error code: \" ++ toString code ++ \")\\n file: \" ++ fn",
"start": [
162,
1
],
"end": [
164,
91
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.otherErrorToString",
"code": "def otherErrorToString (gist : String) (code : UInt32) : Option String → String\n | some details => downCaseFirst gist ++ \" (error code: \" ++ toString code ++ \", \" ++ downCaseFirst details ++ \")\"\n | none => downCaseFirst gist ++ \" (error code: \" ++ toString code ++ \")\"",
"start": [
166,
1
],
"end": [
168,
75
],
"kind": "commanddeclaration"
},
{
"full_name": "IO.Error.toString",
"code": "@[export lean_io_error_to_string]\ndef toString : IO.Error → String\n | unexpectedEof => \"end of file\"\n | inappropriateType (some fn) code details => fopenErrorToString \"inappropriate type\" fn code details\n | inappropriateType none code details => otherErrorToString \"inappropriate type\" code details\n | interrupted fn code details => fopenErrorToString \"interrupted system call\" fn code details\n | invalidArgument (some fn) code details => fopenErrorToString \"invalid argument\" fn code details\n | invalidArgument none code details => otherErrorToString \"invalid argument\" code details\n | noFileOrDirectory fn code _ => fopenErrorToString \"no such file or directory\" fn code none\n | noSuchThing (some fn) code details => fopenErrorToString \"no such thing\" fn code details\n | noSuchThing none code details => otherErrorToString \"no such thing\" code details\n | permissionDenied (some fn) code details => fopenErrorToString details fn code none\n | permissionDenied none code details => otherErrorToString details code none\n | resourceExhausted (some fn) code details => fopenErrorToString \"resource exhausted\" fn code details\n | resourceExhausted none code details => otherErrorToString \"resource exhausted\" code details\n | alreadyExists none code details => otherErrorToString \"already exists\" code details\n | alreadyExists (some fn) code details => fopenErrorToString \"already exists\" fn code details\n | otherError code details => otherErrorToString details code none\n | resourceBusy code details => otherErrorToString \"resource busy\" code details\n | resourceVanished code details => otherErrorToString \"resource vanished\" code details\n | hardwareFault code _ => otherErrorToString \"hardware fault\" code none\n | illegalOperation code details => otherErrorToString \"illegal operation\" code details\n | protocolError code details => otherErrorToString \"protocol error\" code details\n | timeExpired code details => otherErrorToString \"time expired\" code details\n | unsatisfiedConstraints code _ => otherErrorToString \"directory not empty\" code none\n | unsupportedOperation code details => otherErrorToString \"unsupported operation\" code details\n | userError msg => msg",
"start": [
170,
1
],
"end": [
196,
52
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Init/Data/Format/Macro.lean | [
".lake/packages/lean4/src/lean/Init/Data/Format/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Macro.lean"
] | [] |
.lake/packages/lean4/src/lean/Init/Data/Format/Instances.lean | [
".lake/packages/lean4/src/lean/Init/Data/Format/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/Array/Basic.lean",
".lake/packages/lean4/src/lean/Init/Data/ToString/Basic.lean"
] | [
{
"full_name": "List.format",
"code": "def List.format [ToFormat α] : List α → Format\n | [] => \"[]\"\n | xs => Format.sbracket <| Format.joinSep xs (\",\" ++ Format.line)",
"start": [
16,
1
],
"end": [
18,
68
],
"kind": "commanddeclaration"
},
{
"full_name": "Option.format",
"code": "def Option.format {α : Type u} [ToFormat α] : Option α → Format\n | none => \"none\"\n | some a => \"some \" ++ Std.format a",
"start": [
26,
1
],
"end": [
28,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "String.toFormat",
"code": "def String.toFormat (s : String) : Std.Format :=\n Std.Format.joinSep (s.splitOn \"\\n\") Std.Format.line",
"start": [
36,
1
],
"end": [
37,
54
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/SSet.lean | [
".lake/packages/lean4/src/lean/Lean/Data/SMap.lean"
] | [
{
"full_name": "Lean.SSet",
"code": "def SSet (α : Type u) [BEq α] [Hashable α] := SMap α Unit",
"start": [
11,
1
],
"end": [
12,
58
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.empty",
"code": "abbrev empty : SSet α := SMap.empty",
"start": [
19,
1
],
"end": [
19,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.insert",
"code": "abbrev insert (s : SSet α) (a : α) : SSet α :=\n SMap.insert s a ()",
"start": [
21,
1
],
"end": [
22,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.contains",
"code": "abbrev contains (s : SSet α) (a : α) : Bool :=\n SMap.contains s a",
"start": [
24,
1
],
"end": [
25,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.forM",
"code": "abbrev forM [Monad m] (s : SSet α) (f : α → m PUnit) : m PUnit :=\n SMap.forM s fun a _ => f a",
"start": [
27,
1
],
"end": [
28,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.switch",
"code": "abbrev switch (s : SSet α) : SSet α :=\n SMap.switch s",
"start": [
30,
1
],
"end": [
32,
16
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.fold",
"code": "abbrev fold (f : σ → α → σ) (init : σ) (s : SSet α) : σ :=\n SMap.fold (fun d a _ => f d a) init s",
"start": [
34,
1
],
"end": [
35,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.SSet.toList",
"code": "def toList (m : SSet α) : List α :=\n m.fold (init := []) fun es a => a::es",
"start": [
37,
1
],
"end": [
38,
40
],
"kind": "commanddeclaration"
},
{
"full_name": "List.toSSet",
"code": "def List.toSSet [BEq α] [Hashable α] (es : List α) : Lean.SSet α :=\n es.foldl (init := {}) fun s a => s.insert a",
"start": [
44,
1
],
"end": [
45,
46
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/RBTree.lean | [
".lake/packages/lean4/src/lean/Lean/Data/RBMap.lean"
] | [
{
"full_name": "Lean.RBTree",
"code": "def RBTree (α : Type u) (cmp : α → α → Ordering) : Type u :=\n RBMap α Unit cmp",
"start": [
11,
1
],
"end": [
12,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkRBTree",
"code": "@[inline] def mkRBTree (α : Type u) (cmp : α → α → Ordering) : RBTree α cmp :=\n mkRBMap α Unit cmp",
"start": [
17,
1
],
"end": [
18,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.empty",
"code": "@[inline] def empty : RBTree α cmp :=\n RBMap.empty",
"start": [
26,
1
],
"end": [
27,
14
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.depth",
"code": "@[inline] def depth (f : Nat → Nat → Nat) (t : RBTree α cmp) : Nat :=\n RBMap.depth f t",
"start": [
29,
1
],
"end": [
30,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.fold",
"code": "@[inline] def fold (f : β → α → β) (init : β) (t : RBTree α cmp) : β :=\n RBMap.fold (fun r a _ => f r a) init t",
"start": [
32,
1
],
"end": [
33,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.revFold",
"code": "@[inline] def revFold (f : β → α → β) (init : β) (t : RBTree α cmp) : β :=\n RBMap.revFold (fun r a _ => f r a) init t",
"start": [
35,
1
],
"end": [
36,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.foldM",
"code": "@[inline] def foldM {m : Type v → Type w} [Monad m] (f : β → α → m β) (init : β) (t : RBTree α cmp) : m β :=\n RBMap.foldM (fun r a _ => f r a) init t",
"start": [
38,
1
],
"end": [
39,
42
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.forM",
"code": "@[inline] def forM {m : Type v → Type w} [Monad m] (f : α → m PUnit) (t : RBTree α cmp) : m PUnit :=\n t.foldM (fun _ a => f a) ⟨⟩",
"start": [
41,
1
],
"end": [
42,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.forIn",
"code": "@[inline] protected def forIn [Monad m] (t : RBTree α cmp) (init : σ) (f : α → σ → m (ForInStep σ)) : m σ :=\n t.val.forIn init (fun a _ acc => f a acc)",
"start": [
44,
1
],
"end": [
45,
44
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.isEmpty",
"code": "@[inline] def isEmpty (t : RBTree α cmp) : Bool :=\n RBMap.isEmpty t",
"start": [
50,
1
],
"end": [
51,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.toList",
"code": "@[specialize] def toList (t : RBTree α cmp) : List α :=\n t.revFold (fun as a => a::as) []",
"start": [
53,
1
],
"end": [
54,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.toArray",
"code": "@[specialize] def toArray (t : RBTree α cmp) : Array α :=\n t.fold (fun as a => as.push a) #[]",
"start": [
56,
1
],
"end": [
57,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.min",
"code": "@[inline] protected def min (t : RBTree α cmp) : Option α :=\n match RBMap.min t with\n | some ⟨a, _⟩ => some a\n | none => none",
"start": [
59,
1
],
"end": [
62,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.max",
"code": "@[inline] protected def max (t : RBTree α cmp) : Option α :=\n match RBMap.max t with\n | some ⟨a, _⟩ => some a\n | none => none",
"start": [
64,
1
],
"end": [
67,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.insert",
"code": "@[inline] def insert (t : RBTree α cmp) (a : α) : RBTree α cmp :=\n RBMap.insert t a ()",
"start": [
72,
1
],
"end": [
73,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.erase",
"code": "@[inline] def erase (t : RBTree α cmp) (a : α) : RBTree α cmp :=\n RBMap.erase t a",
"start": [
75,
1
],
"end": [
76,
18
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.ofList",
"code": "@[specialize] def ofList : List α → RBTree α cmp\n | [] => mkRBTree ..\n | x::xs => (ofList xs).insert x",
"start": [
78,
1
],
"end": [
80,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.find?",
"code": "@[inline] def find? (t : RBTree α cmp) (a : α) : Option α :=\n match RBMap.findCore? t a with\n | some ⟨a, _⟩ => some a\n | none => none",
"start": [
82,
1
],
"end": [
85,
24
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.contains",
"code": "@[inline] def contains (t : RBTree α cmp) (a : α) : Bool :=\n (t.find? a).isSome",
"start": [
87,
1
],
"end": [
88,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.fromList",
"code": "def fromList (l : List α) (cmp : α → α → Ordering) : RBTree α cmp :=\n l.foldl insert (mkRBTree α cmp)",
"start": [
90,
1
],
"end": [
91,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.fromArray",
"code": "def fromArray (l : Array α) (cmp : α → α → Ordering) : RBTree α cmp :=\n l.foldl insert (mkRBTree α cmp)",
"start": [
93,
1
],
"end": [
94,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.all",
"code": "@[inline] def all (t : RBTree α cmp) (p : α → Bool) : Bool :=\n RBMap.all t (fun a _ => p a)",
"start": [
96,
1
],
"end": [
97,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.any",
"code": "@[inline] def any (t : RBTree α cmp) (p : α → Bool) : Bool :=\n RBMap.any t (fun a _ => p a)",
"start": [
99,
1
],
"end": [
100,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.subset",
"code": "def subset (t₁ t₂ : RBTree α cmp) : Bool :=\n t₁.all fun a => (t₂.find? a).isSome",
"start": [
102,
1
],
"end": [
103,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.seteq",
"code": "def seteq (t₁ t₂ : RBTree α cmp) : Bool :=\n subset t₁ t₂ && subset t₂ t₁",
"start": [
105,
1
],
"end": [
106,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.union",
"code": "def union (t₁ t₂ : RBTree α cmp) : RBTree α cmp :=\n if t₁.isEmpty then\n t₂\n else\n t₂.fold .insert t₁",
"start": [
108,
1
],
"end": [
112,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.RBTree.diff",
"code": "def diff (t₁ t₂ : RBTree α cmp) : RBTree α cmp :=\n t₂.fold .erase t₁",
"start": [
114,
1
],
"end": [
115,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.rbtreeOf",
"code": "def rbtreeOf {α : Type u} (l : List α) (cmp : α → α → Ordering) : RBTree α cmp :=\n RBTree.fromList l cmp",
"start": [
119,
1
],
"end": [
120,
24
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/HashSet.lean | [
".lake/packages/lean4/src/lean/Init/Data/List/Control.lean",
".lake/packages/lean4/src/lean/Init/Data/Nat/Power2.lean"
] | [
{
"full_name": "Lean.HashSetBucket",
"code": "def HashSetBucket (α : Type u) :=\n { b : Array (List α) // b.size.isPowerOfTwo }",
"start": [
12,
1
],
"end": [
13,
48
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetBucket.update",
"code": "def HashSetBucket.update {α : Type u} (data : HashSetBucket α) (i : USize) (d : List α) (h : i.toNat < data.val.size) : HashSetBucket α :=\n ⟨ data.val.uset i d h,\n by erw [Array.size_set]; apply data.property ⟩",
"start": [
15,
1
],
"end": [
17,
51
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetBucket.size_update",
"code": "@[simp] theorem HashSetBucket.size_update {α : Type u} (data : HashSetBucket α) (i : USize) (d : List α) (h : i.toNat < data.val.size) :\n (data.update i d h).val.size = data.val.size",
"start": [
19,
1
],
"end": [
21,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp",
"code": "structure HashSetImp (α : Type u) where\n size : Nat\n buckets : HashSetBucket α",
"start": [
23,
1
],
"end": [
25,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkHashSetImp",
"code": "def mkHashSetImp {α : Type u} (capacity := 8) : HashSetImp α :=\n { size := 0\n buckets :=\n ⟨mkArray ((capacity * 4) / 3).nextPowerOfTwo [],\n by simp; apply Nat.isPowerOfTwo_nextPowerOfTwo⟩ }",
"start": [
27,
1
],
"end": [
31,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.mkIdx",
"code": "@[extern \"lean_hashset_mk_idx\"]\nprivate def mkIdx {sz : Nat} (hash : UInt64) (h : sz.isPowerOfTwo) : { u : USize // u.toNat < sz } :=\n let u := hash.toUSize &&& (sz.toUSize - 1)\n if h' : u.toNat < sz then\n ⟨u, h'⟩\n else\n ⟨0, by simp [USize.toNat, OfNat.ofNat, USize.ofNat, Fin.ofNat']; apply Nat.pos_of_isPowerOfTwo h⟩",
"start": [
37,
1
],
"end": [
44,
102
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.reinsertAux",
"code": "@[inline] def reinsertAux (hashFn : α → UInt64) (data : HashSetBucket α) (a : α) : HashSetBucket α :=\n let ⟨i, h⟩ := mkIdx (hashFn a) data.property\n data.update i (a :: data.val[i]) h",
"start": [
46,
1
],
"end": [
48,
37
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.foldBucketsM",
"code": "@[inline] def foldBucketsM {δ : Type w} {m : Type w → Type w} [Monad m] (data : HashSetBucket α) (d : δ) (f : δ → α → m δ) : m δ :=\n data.val.foldlM (init := d) fun d as => as.foldlM f d",
"start": [
50,
1
],
"end": [
51,
56
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.foldBuckets",
"code": "@[inline] def foldBuckets {δ : Type w} (data : HashSetBucket α) (d : δ) (f : δ → α → δ) : δ :=\n Id.run $ foldBucketsM data d f",
"start": [
53,
1
],
"end": [
54,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.foldM",
"code": "@[inline] def foldM {δ : Type w} {m : Type w → Type w} [Monad m] (f : δ → α → m δ) (d : δ) (h : HashSetImp α) : m δ :=\n foldBucketsM h.buckets d f",
"start": [
56,
1
],
"end": [
57,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.fold",
"code": "@[inline] def fold {δ : Type w} (f : δ → α → δ) (d : δ) (m : HashSetImp α) : δ :=\n foldBuckets m.buckets d f",
"start": [
59,
1
],
"end": [
60,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.forBucketsM",
"code": "@[inline] def forBucketsM {m : Type w → Type w} [Monad m] (data : HashSetBucket α) (f : α → m PUnit) : m PUnit :=\n data.val.forM fun as => as.forM f",
"start": [
62,
1
],
"end": [
63,
36
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.forM",
"code": "@[inline] def forM {m : Type w → Type w} [Monad m] (f : α → m PUnit) (h : HashSetImp α) : m PUnit :=\n forBucketsM h.buckets f",
"start": [
65,
1
],
"end": [
66,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.find?",
"code": "def find? [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Option α :=\n match m with\n | ⟨_, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n buckets.val[i].find? (fun a' => a == a')",
"start": [
68,
1
],
"end": [
72,
45
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.contains",
"code": "def contains [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Bool :=\n match m with\n | ⟨_, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n buckets.val[i].contains a",
"start": [
74,
1
],
"end": [
78,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.moveEntries",
"code": "def moveEntries [Hashable α] (i : Nat) (source : Array (List α)) (target : HashSetBucket α) : HashSetBucket α :=\n if h : i < source.size then\n let idx : Fin source.size := ⟨i, h⟩\n let es : List α := source.get idx\n let source := source.set idx []\n let target := es.foldl (reinsertAux hash) target\n moveEntries (i+1) source target\n else\n target\ntermination_by source.size - i\ndecreasing_by simp_wf; decreasing_trivial_pre_omega",
"start": [
80,
1
],
"end": [
91,
52
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.expand",
"code": "def expand [Hashable α] (size : Nat) (buckets : HashSetBucket α) : HashSetImp α :=\n let bucketsNew : HashSetBucket α := ⟨\n mkArray (buckets.val.size * 2) [],\n by simp; apply Nat.mul2_isPowerOfTwo_of_isPowerOfTwo buckets.property\n ⟩\n { size := size,\n buckets := moveEntries 0 buckets.val bucketsNew }",
"start": [
93,
1
],
"end": [
99,
54
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.insert",
"code": "def insert [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : HashSetImp α :=\n match m with\n | ⟨size, buckets⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n let bkt := buckets.val[i]\n if bkt.contains a\n then\n let buckets' := buckets.update i .nil h\n ⟨size, buckets'.update i (bkt.replace a a) (by simpa [buckets'])⟩\n else\n let size' := size + 1\n let buckets' := buckets.update i (a :: bkt) h\n if size' ≤ buckets.val.size\n then { size := size', buckets := buckets' }\n else expand size' buckets'",
"start": [
101,
1
],
"end": [
116,
33
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.erase",
"code": "def erase [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : HashSetImp α :=\n match m with\n | ⟨ size, buckets ⟩ =>\n let ⟨i, h⟩ := mkIdx (hash a) buckets.property\n let bkt := buckets.val[i]\n if bkt.contains a then\n let buckets' := buckets.update i .nil h\n ⟨size - 1, buckets'.update i (bkt.erase a) (by simpa [buckets'])⟩\n else\n ⟨size, buckets⟩",
"start": [
118,
1
],
"end": [
128,
22
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSetImp.WellFormed",
"code": "inductive WellFormed [BEq α] [Hashable α] : HashSetImp α → Prop where\n | mkWff : ∀ n, WellFormed (mkHashSetImp n)\n | insertWff : ∀ m a, WellFormed m → WellFormed (insert m a)\n | eraseWff : ∀ m a, WellFormed m → WellFormed (erase m a)",
"start": [
130,
1
],
"end": [
133,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet",
"code": "def HashSet (α : Type u) [BEq α] [Hashable α] :=\n { m : HashSetImp α // m.WellFormed }",
"start": [
137,
1
],
"end": [
138,
39
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.mkHashSet",
"code": "def mkHashSet {α : Type u} [BEq α] [Hashable α] (capacity := 8) : HashSet α :=\n ⟨ mkHashSetImp capacity, WellFormed.mkWff capacity ⟩",
"start": [
142,
1
],
"end": [
143,
55
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.empty",
"code": "@[inline] def empty [BEq α] [Hashable α] : HashSet α :=\n mkHashSet",
"start": [
146,
1
],
"end": [
147,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.insert",
"code": "@[inline] def insert (m : HashSet α) (a : α) : HashSet α :=\n match m with\n | ⟨ m, hw ⟩ => ⟨ m.insert a, WellFormed.insertWff m a hw ⟩",
"start": [
156,
1
],
"end": [
158,
61
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.erase",
"code": "@[inline] def erase (m : HashSet α) (a : α) : HashSet α :=\n match m with\n | ⟨ m, hw ⟩ => ⟨ m.erase a, WellFormed.eraseWff m a hw ⟩",
"start": [
160,
1
],
"end": [
162,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.find?",
"code": "@[inline] def find? (m : HashSet α) (a : α) : Option α :=\n match m with\n | ⟨ m, _ ⟩ => m.find? a",
"start": [
164,
1
],
"end": [
166,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.contains",
"code": "@[inline] def contains (m : HashSet α) (a : α) : Bool :=\n match m with\n | ⟨ m, _ ⟩ => m.contains a",
"start": [
168,
1
],
"end": [
170,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.foldM",
"code": "@[inline] def foldM {δ : Type w} {m : Type w → Type w} [Monad m] (f : δ → α → m δ) (init : δ) (h : HashSet α) : m δ :=\n match h with\n | ⟨ h, _ ⟩ => h.foldM f init",
"start": [
172,
1
],
"end": [
174,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.fold",
"code": "@[inline] def fold {δ : Type w} (f : δ → α → δ) (init : δ) (m : HashSet α) : δ :=\n match m with\n | ⟨ m, _ ⟩ => m.fold f init",
"start": [
176,
1
],
"end": [
178,
30
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.forM",
"code": "@[inline] def forM {m : Type w → Type w} [Monad m] (h : HashSet α) (f : α → m PUnit) : m PUnit :=\n match h with\n | ⟨h, _⟩ => h.forM f",
"start": [
180,
1
],
"end": [
182,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.size",
"code": "@[inline] def size (m : HashSet α) : Nat :=\n match m with\n | ⟨ {size := sz, ..}, _ ⟩ => sz",
"start": [
190,
1
],
"end": [
192,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.isEmpty",
"code": "@[inline] def isEmpty (m : HashSet α) : Bool :=\n m.size = 0",
"start": [
194,
1
],
"end": [
195,
13
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.toList",
"code": "def toList (m : HashSet α) : List α :=\n m.fold (init := []) fun r a => a::r",
"start": [
197,
1
],
"end": [
198,
38
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.toArray",
"code": "def toArray (m : HashSet α) : Array α :=\n m.fold (init := #[]) fun r a => r.push a",
"start": [
200,
1
],
"end": [
201,
43
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.numBuckets",
"code": "def numBuckets (m : HashSet α) : Nat :=\n m.val.buckets.val.size",
"start": [
203,
1
],
"end": [
204,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.insertMany",
"code": "def insertMany [ForIn Id ρ α] (s : HashSet α) (as : ρ) : HashSet α := Id.run do\n let mut s := s\n for a in as do\n s := s.insert a\n return s",
"start": [
206,
1
],
"end": [
211,
11
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.HashSet.merge",
"code": "@[inline]\ndef merge {α : Type u} [BEq α] [Hashable α] (s t : HashSet α) : HashSet α :=\n t.fold (init := s) fun s a => s.insert a",
"start": [
213,
1
],
"end": [
218,
43
],
"kind": "commanddeclaration"
}
] |
.lake/packages/lean4/src/lean/Lean/Data/Name.lean | [
".lake/packages/lean4/src/lean/Init/Data/Ord.lean"
] | [
{
"full_name": "Lean.Name.hashEx",
"code": "@[export lean_name_hash_exported] def hashEx : Name → UInt64 :=\n Name.hash",
"start": [
12,
1
],
"end": [
13,
12
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.getPrefix",
"code": "def getPrefix : Name → Name\n | anonymous => anonymous\n | str p _ => p\n | num p _ => p",
"start": [
15,
1
],
"end": [
18,
19
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.getString!",
"code": "def getString! : Name → String\n | str _ s => s\n | _ => unreachable!",
"start": [
20,
1
],
"end": [
22,
28
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.getNumParts",
"code": "def getNumParts : Name → Nat\n | anonymous => 0\n | str p _ => getNumParts p + 1\n | num p _ => getNumParts p + 1",
"start": [
24,
1
],
"end": [
27,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.updatePrefix",
"code": "def updatePrefix : Name → Name → Name\n | anonymous, _ => anonymous\n | str _ s, newP => Name.mkStr newP s\n | num _ s, newP => Name.mkNum newP s",
"start": [
29,
1
],
"end": [
32,
41
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.componentsRev",
"code": "def componentsRev : Name → List Name\n | anonymous => []\n | str n s => Name.mkStr anonymous s :: componentsRev n\n | num n v => Name.mkNum anonymous v :: componentsRev n",
"start": [
34,
1
],
"end": [
37,
59
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.components",
"code": "def components (n : Name) : List Name :=\n n.componentsRev.reverse",
"start": [
39,
1
],
"end": [
40,
26
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.eqStr",
"code": "def eqStr : Name → String → Bool\n | str anonymous s, s' => s == s'\n | _, _ => false",
"start": [
42,
1
],
"end": [
44,
35
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isPrefixOf",
"code": "def isPrefixOf : Name → Name → Bool\n | p, anonymous => p == anonymous\n | p, n@(num p' _) => p == n || isPrefixOf p p'\n | p, n@(str p' _) => p == n || isPrefixOf p p'",
"start": [
46,
1
],
"end": [
49,
49
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isSuffixOf",
"code": "def isSuffixOf : Name → Name → Bool\n | anonymous, _ => true\n | str p₁ s₁, str p₂ s₂ => s₁ == s₂ && isSuffixOf p₁ p₂\n | num p₁ n₁, num p₂ n₂ => n₁ == n₂ && isSuffixOf p₁ p₂\n | _, _ => false",
"start": [
52,
1
],
"end": [
56,
34
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.cmp",
"code": "def cmp : Name → Name → Ordering\n | anonymous, anonymous => Ordering.eq\n | anonymous, _ => Ordering.lt\n | _, anonymous => Ordering.gt\n | num p₁ i₁, num p₂ i₂ =>\n match cmp p₁ p₂ with\n | Ordering.eq => compare i₁ i₂\n | ord => ord\n | num _ _, str _ _ => Ordering.lt\n | str _ _, num _ _ => Ordering.gt\n | str p₁ n₁, str p₂ n₂ =>\n match cmp p₁ p₂ with\n | Ordering.eq => compare n₁ n₂\n | ord => ord",
"start": [
58,
1
],
"end": [
71,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.lt",
"code": "def lt (x y : Name) : Bool :=\n cmp x y == Ordering.lt",
"start": [
73,
1
],
"end": [
74,
25
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.quickCmpAux",
"code": "def quickCmpAux : Name → Name → Ordering\n | anonymous, anonymous => Ordering.eq\n | anonymous, _ => Ordering.lt\n | _, anonymous => Ordering.gt\n | num n v, num n' v' =>\n match compare v v' with\n | Ordering.eq => n.quickCmpAux n'\n | ord => ord\n | num _ _, str _ _ => Ordering.lt\n | str _ _, num _ _ => Ordering.gt\n | str n s, str n' s' =>\n match compare s s' with\n | Ordering.eq => n.quickCmpAux n'\n | ord => ord",
"start": [
76,
1
],
"end": [
89,
17
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.quickCmp",
"code": "def quickCmp (n₁ n₂ : Name) : Ordering :=\n match compare n₁.hash n₂.hash with\n | Ordering.eq => quickCmpAux n₁ n₂\n | ord => ord",
"start": [
91,
1
],
"end": [
94,
15
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.quickLt",
"code": "def quickLt (n₁ n₂ : Name) : Bool :=\n quickCmp n₁ n₂ == Ordering.lt",
"start": [
96,
1
],
"end": [
97,
32
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.hasNum",
"code": "def hasNum : Name → Bool\n | .anonymous => false\n | .str p _ => p.hasNum\n | .num _ _ => true",
"start": [
99,
1
],
"end": [
103,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isInternal",
"code": "def isInternal : Name → Bool\n | str p s => s.get 0 == '_' || isInternal p\n | num p _ => isInternal p\n | _ => false",
"start": [
105,
1
],
"end": [
110,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isInternalOrNum",
"code": "def isInternalOrNum : Name → Bool\n | .str p s => s.get 0 == '_' || isInternalOrNum p\n | .num _ _ => true\n | _ => false",
"start": [
112,
1
],
"end": [
121,
21
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isInternalDetail",
"code": "def isInternalDetail : Name → Bool\n | .str p s =>\n s.startsWith \"_\"\n || matchPrefix s \"eq_\"\n || matchPrefix s \"match_\"\n || matchPrefix s \"proof_\"\n || p.isInternalOrNum\n | .num _ _ => true\n | p => p.isInternalOrNum\nwhere\n \n matchPrefix (s : String) (pre : String) :=\n s.startsWith pre && (s |>.drop pre.length |>.all Char.isDigit)",
"start": [
123,
1
],
"end": [
141,
67
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isImplementationDetail",
"code": "def isImplementationDetail : Name → Bool\n | str anonymous s => s.startsWith \"__\"\n | num p _ => p.isImplementationDetail\n | str p _ => p.isImplementationDetail\n | anonymous => false",
"start": [
143,
1
],
"end": [
152,
23
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isAtomic",
"code": "def isAtomic : Name → Bool\n | anonymous => true\n | str anonymous _ => true\n | num anonymous _ => true\n | _ => false",
"start": [
154,
1
],
"end": [
158,
29
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isAnonymous",
"code": "def isAnonymous : Name → Bool\n | anonymous => true\n | _ => false",
"start": [
160,
1
],
"end": [
162,
31
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isStr",
"code": "def isStr : Name → Bool\n | str .. => true\n | _ => false",
"start": [
164,
1
],
"end": [
166,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.isNum",
"code": "def isNum : Name → Bool\n | num .. => true\n | _ => false",
"start": [
168,
1
],
"end": [
170,
20
],
"kind": "commanddeclaration"
},
{
"full_name": "Lean.Name.anyS",
"code": "def anyS (n : Name) (f : String → Bool) : Bool :=\n match n with\n | .str p s => f s || p.anyS f\n | .num p _ => p.anyS f\n | _ => false",
"start": [
172,
1
],
"end": [
185,
15
],
"kind": "commanddeclaration"
}
] |