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_data_value_beq]
Instances For
@[export lean_mk_bool_data_value]
Equations
Instances For
@[export lean_data_value_bool]
Equations
- (Lean.DataValue.ofBool b).getBoolEx = b
- x.getBoolEx = false
Instances For
Equations
- (Lean.DataValue.ofString a).sameCtor (Lean.DataValue.ofString b) = true
- (Lean.DataValue.ofBool a).sameCtor (Lean.DataValue.ofBool b) = true
- (Lean.DataValue.ofName a).sameCtor (Lean.DataValue.ofName b) = true
- (Lean.DataValue.ofNat a).sameCtor (Lean.DataValue.ofNat b) = true
- (Lean.DataValue.ofInt a).sameCtor (Lean.DataValue.ofInt b) = true
- (Lean.DataValue.ofSyntax a).sameCtor (Lean.DataValue.ofSyntax b) = true
- x✝.sameCtor x = false
Instances For
@[export lean_data_value_to_string]
Equations
- (Lean.DataValue.ofString a).str = a
- (Lean.DataValue.ofBool a).str = toString a
- (Lean.DataValue.ofName a).str = toString a
- (Lean.DataValue.ofNat a).str = toString a
- (Lean.DataValue.ofInt a).str = toString a
- (Lean.DataValue.ofSyntax a).str = toString a
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.instToString = { toString := fun (m : Lean.KVMap) => toString m.entries }
Equations
- { entries := m }.isEmpty = m.isEmpty
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
- { entries := m }.find x = Lean.KVMap.findCore m x
Instances For
Equations
- m.findD k d₀ = (m.find k).getD 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
- { entries := m }.insert x✝ x = { entries := Lean.KVMap.insertCore m x✝ x }
Instances For
Equations
- m.contains n = (m.find n).isSome
Instances For
Erase an entry from the map
Equations
- { entries := m }.erase x = { entries := List.filter (fun (a : Lake.Name × Lean.DataValue) => decide (a.fst ≠ x)) m }
Instances For
Equations
- m.getString k defVal = match m.find k with | some (Lean.DataValue.ofString v) => v | x => defVal
Instances For
Equations
- m.getNat k defVal = match m.find k with | some (Lean.DataValue.ofNat v) => v | x => defVal
Instances For
Equations
- m.getInt k defVal = match m.find k with | some (Lean.DataValue.ofInt v) => v | x => defVal
Instances For
Equations
- m.getBool k defVal = match m.find 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
- m.getName k defVal = match m.find 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
- m.getSyntax k defVal = match m.find k with | some (Lean.DataValue.ofSyntax v) => v | x => defVal
Instances For
Equations
- m.setString k v = m.insert k (Lean.DataValue.ofString v)
Instances For
Equations
- m.setNat k v = m.insert k (Lean.DataValue.ofNat v)
Instances For
Equations
- m.setInt k v = m.insert k (Lean.DataValue.ofInt v)
Instances For
Equations
- m.setBool k v = m.insert k (Lean.DataValue.ofBool v)
Instances For
Equations
- m.setName k v = m.insert k (Lean.DataValue.ofName v)
Instances For
Equations
- m.setSyntax k v = m.insert k (Lean.DataValue.ofSyntax v)
Instances For
Update a String
entry based on its current value.
Equations
- m.updateString k f = m.insert k (Lean.DataValue.ofString (f (m.getString k)))
Instances For
Update a Nat
entry based on its current value.
Equations
- m.updateNat k f = m.insert k (Lean.DataValue.ofNat (f (m.getNat k)))
Instances For
Update an Int
entry based on its current value.
Equations
- m.updateInt k f = m.insert k (Lean.DataValue.ofInt (f (m.getInt k)))
Instances For
Update a Bool
entry based on its current value.
Equations
- m.updateBool k f = m.insert k (Lean.DataValue.ofBool (f (m.getBool k)))
Instances For
Update a Name
entry based on its current value.
Equations
- m.updateName k f = m.insert k (Lean.DataValue.ofName (f (m.getName k)))
Instances For
Update a Syntax
entry based on its current value.
Equations
- m.updateSyntax k f = m.insert k (Lean.DataValue.ofSyntax (f (m.getSyntax 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
- kv.forIn init f = kv.entries.forIn init f
Instances For
Equations
- Lean.KVMap.subsetAux [] x = true
- Lean.KVMap.subsetAux ((k, v₁) :: m₁) x = match x.find k with | some v₂ => v₁ == v₂ && Lean.KVMap.subsetAux m₁ x | none => false
Instances For
Equations
- { entries := m₁ }.subset x = Lean.KVMap.subsetAux m₁ x
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
Instances For
Equations
- Lean.KVMap.instBEq = { beq := Lean.KVMap.eqv }
- toDataValue : α → Lean.DataValue
- ofDataValue? : Lean.DataValue → Option α
Instances
@[inline]
Equations
- m.set k v = m.insert 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 α)
:
Instances For
Equations
- Lean.KVMap.instValueDataValue = { toDataValue := id, ofDataValue? := some }
Equations
- Lean.KVMap.instValueBool = { toDataValue := Lean.DataValue.ofBool, ofDataValue? := fun (x : Lean.DataValue) => match x with | Lean.DataValue.ofBool b => some b | x => none }
Equations
- Lean.KVMap.instValueNat = { toDataValue := Lean.DataValue.ofNat, ofDataValue? := fun (x : Lean.DataValue) => match x with | Lean.DataValue.ofNat n => some n | x => none }
Equations
- Lean.KVMap.instValueInt = { toDataValue := Lean.DataValue.ofInt, ofDataValue? := fun (x : Lean.DataValue) => match x with | Lean.DataValue.ofInt i => some i | x => none }
Equations
- Lean.KVMap.instValueName = { toDataValue := Lean.DataValue.ofName, ofDataValue? := fun (x : Lean.DataValue) => match x with | Lean.DataValue.ofName n => some n | x => none }
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.