Store a value in a thunk. Note that the value has already been computed, so there is no laziness.
Equations
- Thunk.pure a = { fn := fun x => a }
Equations
- Thunk.bind x f = { fn := fun x => Thunk.get (f (Thunk.get x)) }
Equations
- «term_<->_» = Lean.ParserDescr.trailingNode `«term_<->_» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " <-> ") (Lean.ParserDescr.cat `term 21))
Equations
- «term_↔_» = Lean.ParserDescr.trailingNode `«term_↔_» 20 21 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ↔ ") (Lean.ParserDescr.cat `term 21))
Equations
- «term_⊕_» = Lean.ParserDescr.trailingNode `«term_⊕_» 30 31 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊕ ") (Lean.ParserDescr.cat `term 30))
Equations
- «term_⊕'_» = Lean.ParserDescr.trailingNode `«term_⊕'_» 30 31 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊕' ") (Lean.ParserDescr.cat `term 30))
Instances
- instForIn
- ByteArray.instForInByteArrayUInt8
- Lean.Syntax.instForInTopDownSyntax
- Lean.KVMap.instForInKVMapProdNameDataValue
- Lean.LocalContext.instForInLocalContextLocalDecl
- Std.Range.instForInRangeNat
- Lean.NameSet.instForInNameSetName
- Lean.instForInMVarIdSetMVarId
- Std.RBTree.instForInRBTree
- Std.PersistentArray.instForInPersistentArray
- List.instForInList
- Subarray.instForInSubarray
- Std.AssocList.instForInAssocListProd
- Array.instForInArray
- Lean.instForInLoopUnit
- Lean.instForInMVarIdMapProdMVarId
- Lean.instForInOptionsProdNameDataValue
- FloatArray.instForInFloatArrayFloat
- Std.RBMap.instForInRBMapProd
- Lean.instForInFVarIdSetFVarId
- pure: {α β σ : Type u} → α → σ → DoResultPRBC α β σ
- return: {α β σ : Type u} → β → σ → DoResultPRBC α β σ
- break: {α β σ : Type u} → σ → DoResultPRBC α β σ
- continue: {α β σ : Type u} → σ → DoResultPRBC α β σ
- pure: {α β σ : Type u} → α → σ → DoResultPR α β σ
- return: {α β σ : Type u} → β → σ → DoResultPR α β σ
- break: {σ : Type u} → σ → DoResultBC σ
- continue: {σ : Type u} → σ → DoResultBC σ
- pureReturn: {α σ : Type u} → α → σ → DoResultSBC α σ
- break: {α σ : Type u} → σ → DoResultSBC α σ
- continue: {α σ : Type u} → σ → DoResultSBC α σ
Equations
- «term_≈_» = Lean.ParserDescr.trailingNode `«term_≈_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≈ ") (Lean.ParserDescr.cat `term 51))
- emptyCollection : α
Instances
- Lean.instEmptyCollectionFVarIdMap
- ByteArray.instEmptyCollectionByteArray
- Lean.Parser.Trie.instEmptyCollectionTrie
- Std.HashMap.instEmptyCollectionHashMap
- Lean.NameSSet.instEmptyCollectionNameSSet
- Lean.NameHashSet.instEmptyCollectionNameHashSet
- Lean.NameSet.instEmptyCollectionNameSet
- Lean.instMVarIdSetEmptyCollection
- Lean.instEmptyCollectionPrefixTree
- Std.instEmptyCollectionRBTree
- List.instEmptyCollectionList
- Lean.instEmptyCollectionNameTrie
- Lean.Parser.TokenMap.instEmptyCollectionTokenMap
- Std.AssocList.instEmptyCollectionAssocList
- Lean.instFVarIdHashSetEmptyCollection
- Array.instEmptyCollectionArray
- Lean.instEmptyCollectionMVarIdMap
- Std.HashSet.instEmptyCollectionHashSet
- Std.PersistentHashSet.instEmptyCollectionPersistentHashSet
- FloatArray.instEmptyCollectionFloatArray
- Lean.NameMap.instEmptyCollectionNameMap
- Std.instEmptyCollectionRBMap
- Lean.instFVarIdSetEmptyCollection
Equations
- «term{}» = Lean.ParserDescr.node `«term{}» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "{") (Lean.ParserDescr.symbol "}"))
Equations
- «term∅» = Lean.ParserDescr.node `«term∅» 1024 (Lean.ParserDescr.symbol "∅")
Task priority. Tasks with higher priority will always be scheduled before ones with lower priority.
Equations
Any priority higher than Task.Priority.max
will result in the task being scheduled immediately on a dedicated thread.
This is particularly useful for long-running and/or I/O-bound tasks since Lean will by default allocate no more
non-dedicated workers than the number of cores to reduce context switches.
Equations
Equations
- Task.spawn fn prio = { get := fn () }
Equations
- «term_!=_» = Lean.ParserDescr.trailingNode `«term_!=_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " != ") (Lean.ParserDescr.cat `term 51))
Instances
- List.instLawfulBEqListInstBEqList
- Nat.Linear.instLawfulBEqPolyCnstrInstBEqPolyCnstr
- Nat.instLawfulBEqNatInstBEqNat
- instLawfulBEqProdInstBEqProd
- instLawfulBEqBoolInstBEqInstDecidableEqBool
- instLawfulBEqStringInstBEqInstDecidableEqString
- instLawfulBEqCharInstBEqInstDecidableEqChar
- Int.instLawfulBEqIntInstBEqInstDecidableEqInt
Equations
- «term_≠_» = Lean.ParserDescr.trailingNode `«term_≠_» 50 51 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≠ ") (Lean.ParserDescr.cat `term 51))
Equations
Equations
- Decidable.byCases h1 h2 = match dec with | isTrue h => h1 h | isFalse h => h2 h
Equations
- decidable_of_decidable_of_eq h = h ▸ hp
Equations
- instDecidableForAll = if hp : p then if hq : q then isTrue (instDecidableForAll.proof_1 hq) else isFalse (_ : (p → q) → False) else isTrue (instDecidableForAll.proof_3 hp)
Equations
- noConfusionTypeEnum f P x y = Decidable.casesOn (inst (f x) (f y)) (fun x => P) fun x => P → P
Equations
- noConfusionEnum f h = Decidable.casesOn (inst (f x) (f y)) (fun h' => False.elim (_ : False)) fun x x => x
Equations
- instInhabitedPNonScalar = { default := PNonScalar.mk default }
Equations
- instInhabitedTrue = { default := True.intro }
Equations
- instInhabitedForInStep = { default := ForInStep.done default }
Equations
- instInhabitedNonScalar = { default := { val := default } }
- intro :: (
- allEq : ∀ (a b : α), a = b
- )
Equations
- refl : (x : α) → r x x
- symm : {x y : α} → r x y → r y x
- trans : {x y z : α} → r x y → r y z → r x z
Equations
- Subrelation q r = ({x y : α} → q x y → r x y)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- prodHasDecidableLt x x = inferInstanceAs (Decidable (x.fst < x.fst ∨ x.fst = x.fst ∧ x.snd < x.snd))
Equations
Equations
- instInhabitedPUnit = { default := PUnit.unit }
Equations
- instDecidableEqPUnit a b = isTrue (_ : a = b)
- r : α → α → Prop
- iseqv : Equivalence r
Instances
Equations
- instHasEquiv = { Equiv := Setoid.r }
Equations
- Quot.liftOn q f c = Quot.lift f c q
Equations
- Quot.indep f a = { fst := Quot.mk r a, snd := f a }
Equations
- Quot.hrecOn q f c = Quot.recOn q f (_ : ∀ (a b : α), r a b → (_ : Quot.mk r a = Quot.mk r b) ▸ f a = f b)
Equations
- Quotient.mk s a = Quot.mk Setoid.r a
Equations
- Quotient.mk' a = Quotient.mk s a
Equations
Equations
- Quotient.lift f = Quot.lift f
Equations
- Quotient.liftOn q f c = Quot.liftOn q f c
Equations
- Quotient.rec f h q = Quot.rec f h q
Equations
- Quotient.recOn q f h = Quot.recOn q f h
Equations
Equations
- Quotient.hrecOn q f c = Quot.hrecOn q f c
Equations
- One or more equations did not get rendered due to their size.
Equations
- Quotient.liftOn₂ q₁ q₂ f c = Quotient.lift₂ f c q₁ q₂
Equations
- Quotient.recOnSubsingleton₂ q₁ q₂ g = Quot.recOnSubsingleton q₁ fun a => Quot.recOnSubsingleton q₂ fun a_1 => g a a_1
Equations
- One or more equations did not get rendered due to their size.
Equations
- Function.Equiv f₁ f₂ = ∀ (x : α), f₁ x = f₂ x
Equations
- Squash.lift s f = Quot.lift f (_ : ∀ (x x_1 : α), True → f x = f x_1) s
- antisymm : ∀ {a b : α}, r a b → r b a → a = b
When the kernel tries to reduce a term Lean.reduceBool c
, it will invoke the Lean interpreter to evaluate c
.
The kernel will not use the interpreter if c
is not a constant.
This feature is useful for performing proofs by reflection.
Remark: the Lean frontend allows terms of the from Lean.reduceBool t
where t
is a term not containing
free variables. The frontend automatically declares a fresh auxiliary constant c
and replaces the term with
Lean.reduceBool c
. The main motivation is that the code for t
will be pre-compiled.
Warning: by using this feature, the Lean compiler and interpreter become part of your trusted code base. This is extra 30k lines of code. More importantly, you will probably not be able to check your developement using external type checkers (e.g., Trepplein) that do not implement this feature. Keep in mind that if you are using Lean as programming language, you are already trusting the Lean compiler and interpreter. So, you are mainly losing the capability of type checking your developement using external checkers.
Recall that the compiler trusts the correctness of all [implementedBy ...]
and [extern ...]
annotations.
If an extern function is executed, then the trusted code base will also include the implementation of the associated
foreign function.
Similar to Lean.reduceBool
for closed Nat
terms.
Remark: we do not have plans for supporting a generic reduceValue {α} (a : α) : α := a
.
The main issue is that it is non-trivial to convert an arbitrary runtime object back into a Lean expression.
We believe Lean.reduceBool
enables most interesting applications (e.g., proof by reflection).
- assoc : ∀ (a b c : α), op (op a b) c = op a (op b c)
Instances
- comm : ∀ (a b : α), op a b = op b a
Instances
- idempotent : ∀ (x : α), op x x = x