IR element types #
An IR value has a tensor shape and an element type. These descriptors identify the element representation without choosing a device, storage buffer, or kernel. Binary and decimal descriptors reuse FloatLib's validated formats. A configured binary128 or custom binary format is not a separate IR constructor.
context preserves scalar-polymorphic Lean graphs: the caller chooses their
element type through the existing Storage and Context instances. Captured
mixed-dtype programs use explicit descriptors instead.
Named types provide an extension point for a frontend or backend with another representation. Describing a type does not supply its arithmetic implementation; an interpreter must register the corresponding semantics or reject execution.
Device-independent element representation of a tensor value.
- context : DType
Scalar type supplied by a homogeneous Lean graph's caller.
- bool : DType
Boolean values, distinct from numeric zero/one tensors.
- integer
(signed : Bool)
(width : Option ℕ := none)
: DType
Signed or unsigned integers;
nonemeans unbounded, and a width must be positive. - binary
(format : FloatLib.Floats.Formats.BinaryInterchange.FloatFormat)
: DType
A validated FloatLib binary format, including its bias and exceptional-value encoding.
- decimal
(format : FloatLib.Floats.Formats.DecimalInterchange.Format)
: DType
A validated FloatLib decimal interchange format.
- posit
(bits : ℕ)
: DType
A Posit Standard encoding of at least two bits.
- rational : DType
Exact rational values.
- real : DType
Mathematical real values, for specification interpreters.
- complex
(component : DType)
: DType
Real and imaginary components have the same explicitly described element type.
- named
(name : Lean.Name)
(parameters : Array ℕ := #[])
: DType
An extension identified by a qualified name and static natural-number parameters.
Instances For
Brain floating point with eight exponent bits and seven fraction bits.
Instances For
Whether parameters not already validated by FloatLib form a usable descriptor.
Instances For
Compact type spelling for errors and graph displays, including custom format parameters.
Instances For
Preserve numeric and escaped name components, rather than parsing a display spelling.
Instances For
JSON nesting depth, computed without the partial printer or proof-only SizeOf code.
Instances For
Maximum nesting among an array's entries.
Instances For
Maximum nesting among an object's values; keys do not add a component level.
Instances For
Encode the complete element representation, including format bias and name components.