Records #
Record fields is both the index of a record-sorted term and the Lean value such a term denotes,
fields being its named fields in order. The order is part of the sort: {a : Int, b : Bool}
and {b : Bool, a : Int} are different sorts.
def origin : Record [("x", Int), ("y", Int)] := .cons "x" 0 (.last "y" 0)
#eval origin.get "y" -- 0
Equations
- Cvc.ToTypFields.instConsProdStringTypeMkOfToTyp = { typs := (name, Cvc.ToTyp.typ α) :: Cvc.ToTypFields.typs fields }
name is one of fields, with type gamma: where it sits, and how to reach it.
Resolved by instance search, so a name that is not a field, or one asked for at the wrong type, does not compile.
Where the field sits in
fields.- get : Values fields → gamma
The field's value.
The values, with this field's replaced.
Instances
A field's value.
Total: a name that is not a field has no FieldOf instance, so there is no none to answer.
Equations
- r.get name = Cvc.FieldOf.get name r.values
Instances For
Instances for nesting #
A record's order, equality, hash and string form are lifted field by field, each through its own class, so a record demands of its fields only what is asked of the record.
Equations
- Cvc.instOrdFieldsNilProdStringType = { compare := fun (x x_1 : Cvc.Values []) => Ordering.eq }
Lifts DecidableEq over a record's fields.
- decEq : DecidableEq (Values fields)
Decides equality of two records' values.
Instances
Equations
- Cvc.instDecidableEqFieldsNilProdStringType = { decEq := fun (x x_1 : Cvc.Values []) => isTrue ⋯ }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Cvc.instHashableFieldsNilProdStringType = { hash := fun (x : Cvc.Values []) => 0 }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Cvc.instToStringFieldsNilProdStringType = { strings := fun (x : Cvc.Values []) => [] }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Cvc.instOrdRecordOfOrdFields = { compare := fun (a b : Cvc.Record fields) => Cvc.OrdFields.compare a.values b.values }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Cvc.instHashableRecordOfHashableFields = { hash := fun (r : Cvc.Record fields) => Cvc.HashableFields.hash r.values }
Equations
- Cvc.instToStringRecordOfToStringFields = { toString := fun (r : Cvc.Record fields) => "{" ++ ", ".intercalate (Cvc.ToStringFields.strings r.values) ++ "}" }
Equations
- Cvc.instToTypRecordOfToTypFields = { typ := Cvc.Typ.record (Cvc.ToTypFields.typs fields) }