Value stored in a key-value map.
- ofString: String → Lean.DataValue
- ofBool: Bool → Lean.DataValue
- ofName: Lake.Name → Lean.DataValue
- ofNat: Nat → Lean.DataValue
- ofInt: Int → Lean.DataValue
- ofSyntax: Lean.Syntax → Lean.DataValue
Instances For
Equations
- Lean.instInhabitedDataValue = { default := Lean.DataValue.ofString default }
Equations
- Lean.instBEqDataValue = { beq := Lean.beqDataValue✝ }
Equations
- Lean.instReprDataValue = { reprPrec := Lean.reprDataValue✝ }
@[export lean_mk_bool_data_value]
Equations
Instances For
@[export lean_data_value_bool]
Equations
- Lean.DataValue.getBoolEx x = match x with | Lean.DataValue.ofBool b => b | x => false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[export lean_data_value_to_string]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.instToStringDataValue = { toString := Lean.DataValue.str }
Equations
- Lean.instCoeStringDataValue = { coe := Lean.DataValue.ofString }
Equations
- Lean.instCoeBoolDataValue = { coe := Lean.DataValue.ofBool }
Equations
- Lean.instCoeNameDataValue = { coe := Lean.DataValue.ofName }
Equations
- Lean.instCoeNatDataValue = { coe := Lean.DataValue.ofNat }
Equations
- Lean.instCoeIntDataValue = { coe := Lean.DataValue.ofInt }
Equations
- Lean.instCoeSyntaxDataValue = { coe := Lean.DataValue.ofSyntax }
A key-value map. We use it to represent user-selected options and Expr.mdata
.
Remark: we do not use RBMap
here because we need to manipulate KVMap
objects in
C++ and RBMap
is implemented in Lean. So, we use just a List
until we can
generate C++ code from Lean code.
- entries : List (Lake.Name × Lean.DataValue)
Instances For
Equations
- Lean.instInhabitedKVMap = { default := { entries := default } }
Equations
- Lean.instReprKVMap = { reprPrec := Lean.reprKVMap✝ }
Equations
- Lean.KVMap.instToStringKVMap = { toString := fun (m : Lean.KVMap) => toString m.entries }
Equations
- Lean.KVMap.isEmpty x = match x with | { entries := m } => List.isEmpty m
Instances For
Equations
- Lean.KVMap.size m = List.length m.entries
Instances For
Equations
- Lean.KVMap.findCore [] x = none
- Lean.KVMap.findCore ((k, v) :: m) x = if (k == x) = true then some v else Lean.KVMap.findCore m x
Instances For
Equations
- Lean.KVMap.find x✝ x = match x✝, x with | { entries := m }, k => Lean.KVMap.findCore m k
Instances For
Equations
- Lean.KVMap.findD m k d₀ = Option.getD (Lean.KVMap.find m k) d₀
Instances For
Equations
- Lean.KVMap.insertCore [] x✝ x = [(x✝, x)]
- Lean.KVMap.insertCore ((k, v) :: m) x✝ x = if (k == x✝) = true then (k, x) :: m else (k, v) :: Lean.KVMap.insertCore m x✝ x
Instances For
Equations
- Lean.KVMap.insert x✝¹ x✝ x = match x✝¹, x✝, x with | { entries := m }, k, v => { entries := Lean.KVMap.insertCore m k v }
Instances For
Equations
- Lean.KVMap.contains m n = Option.isSome (Lean.KVMap.find m n)
Instances For
Erase an entry from the map
Equations
- Lean.KVMap.erase x✝ x = match x✝, x with | { entries := m }, k => { entries := List.filter (fun (a : Lake.Name × Lean.DataValue) => decide (a.fst ≠ k)) m }
Instances For
Equations
- Lean.KVMap.getString m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofString v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getNat m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofNat v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getInt m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofInt v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.getBool m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofBool v) => v | x => defVal
Instances For
def
Lean.KVMap.getName
(m : Lean.KVMap)
(k : Lake.Name)
(defVal : optParam Lake.Name Lean.Name.anonymous)
:
Equations
- Lean.KVMap.getName m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofName v) => v | x => defVal
Instances For
def
Lean.KVMap.getSyntax
(m : Lean.KVMap)
(k : Lake.Name)
(defVal : optParam Lean.Syntax Lean.Syntax.missing)
:
Equations
- Lean.KVMap.getSyntax m k defVal = match Lean.KVMap.find m k with | some (Lean.DataValue.ofSyntax v) => v | x => defVal
Instances For
Equations
- Lean.KVMap.setString m k v = Lean.KVMap.insert m k (Lean.DataValue.ofString v)
Instances For
Equations
- Lean.KVMap.setNat m k v = Lean.KVMap.insert m k (Lean.DataValue.ofNat v)
Instances For
Equations
- Lean.KVMap.setInt m k v = Lean.KVMap.insert m k (Lean.DataValue.ofInt v)
Instances For
Equations
- Lean.KVMap.setBool m k v = Lean.KVMap.insert m k (Lean.DataValue.ofBool v)
Instances For
Equations
- Lean.KVMap.setName m k v = Lean.KVMap.insert m k (Lean.DataValue.ofName v)
Instances For
Equations
- Lean.KVMap.setSyntax m k v = Lean.KVMap.insert m k (Lean.DataValue.ofSyntax v)
Instances For
Update a String
entry based on its current value.
Equations
- Lean.KVMap.updateString m k f = Lean.KVMap.insert m k (Lean.DataValue.ofString (f (Lean.KVMap.getString m k)))
Instances For
Update a Nat
entry based on its current value.
Equations
- Lean.KVMap.updateNat m k f = Lean.KVMap.insert m k (Lean.DataValue.ofNat (f (Lean.KVMap.getNat m k)))
Instances For
Update an Int
entry based on its current value.
Equations
- Lean.KVMap.updateInt m k f = Lean.KVMap.insert m k (Lean.DataValue.ofInt (f (Lean.KVMap.getInt m k)))
Instances For
Update a Bool
entry based on its current value.
Equations
- Lean.KVMap.updateBool m k f = Lean.KVMap.insert m k (Lean.DataValue.ofBool (f (Lean.KVMap.getBool m k)))
Instances For
Update a Name
entry based on its current value.
Equations
- Lean.KVMap.updateName m k f = Lean.KVMap.insert m k (Lean.DataValue.ofName (f (Lean.KVMap.getName m k)))
Instances For
Update a Syntax
entry based on its current value.
Equations
- Lean.KVMap.updateSyntax m k f = Lean.KVMap.insert m k (Lean.DataValue.ofSyntax (f (Lean.KVMap.getSyntax m k)))
Instances For
@[inline]
def
Lean.KVMap.forIn
{δ : Type w}
{m : Type w → Type w'}
[Monad m]
(kv : Lean.KVMap)
(init : δ)
(f : Lake.Name × Lean.DataValue → δ → m (ForInStep δ))
:
m δ
Equations
- Lean.KVMap.forIn kv init f = List.forIn kv.entries init f
Instances For
Equations
- Lean.KVMap.subsetAux [] x = true
- Lean.KVMap.subsetAux ((k, v₁) :: m₁) x = match Lean.KVMap.find x k with | some v₂ => v₁ == v₂ && Lean.KVMap.subsetAux m₁ x | none => false
Instances For
Equations
- Lean.KVMap.subset x✝ x = match x✝, x with | { entries := m₁ }, m₂ => Lean.KVMap.subsetAux m₁ m₂
Instances For
def
Lean.KVMap.mergeBy
(mergeFn : Lake.Name → Lean.DataValue → Lean.DataValue → Lean.DataValue)
(l : Lean.KVMap)
(r : Lean.KVMap)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.KVMap.eqv m₁ m₂ = (Lean.KVMap.subset m₁ m₂ && Lean.KVMap.subset m₂ m₁)
Instances For
Equations
- Lean.KVMap.instBEqKVMap = { beq := Lean.KVMap.eqv }
- toDataValue : α → Lean.DataValue
- ofDataValue? : Lean.DataValue → Option α
Instances
@[inline]
Equations
- Lean.KVMap.get? m k = Option.bind (Lean.KVMap.find m k) Lean.KVMap.Value.ofDataValue?
Instances For
@[inline]
Equations
- Lean.KVMap.get m k defVal = Option.getD (Lean.KVMap.get? m k) defVal
Instances For
@[inline]
Equations
- Lean.KVMap.set m k v = Lean.KVMap.insert m k (Lean.KVMap.Value.toDataValue v)
Instances For
@[inline]
def
Lean.KVMap.update
{α : Type}
[Lean.KVMap.Value α]
(m : Lean.KVMap)
(k : Lake.Name)
(f : Option α → Option α)
:
Equations
- Lean.KVMap.update m k f = match f (Lean.KVMap.get? m k) with | some a => Lean.KVMap.set m k a | none => Lean.KVMap.erase m k
Instances For
Equations
- Lean.KVMap.instValueDataValue = { toDataValue := id, ofDataValue? := some }
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
- 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
- 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.