Structure instances are of the form:
"{" >> optional (atomic (sepBy1 termParser ", " >> " with "))
>> manyIndent (group ((structInstFieldAbbrev <|> structInstField) >> optional ", "))
>> optEllipsis
>> optional (" : " >> termParser)
>> " }"
Equations
- One or more equations did not get rendered due to their size.
Expand field abbreviations. Example: { x, y := 0 }
expands to { x := x, y := 0 }
Equations
- One or more equations did not get rendered due to their size.
- stx : Lean.Syntax
- structName : Lean.Name
Equations
- Lean.Elab.Term.StructInst.instInhabitedExplicitSourceInfo = { default := { stx := default, structName := default } }
Equations
- Lean.Elab.Term.StructInst.Source.isNone _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Source.none => true | x => false
- fieldName: Lean.Syntax → Lean.Name → Lean.Elab.Term.StructInst.FieldLHS
- fieldIndex: Lean.Syntax → Nat → Lean.Elab.Term.StructInst.FieldLHS
- modifyOp: Lean.Syntax → Lean.Syntax → Lean.Elab.Term.StructInst.FieldLHS
Equations
- Lean.Elab.Term.StructInst.instInhabitedFieldLHS = { default := Lean.Elab.Term.StructInst.FieldLHS.fieldName default default }
Equations
- One or more equations did not get rendered due to their size.
- term: {σ : Type} → Lean.Syntax → Lean.Elab.Term.StructInst.FieldVal σ
- nested: {σ : Type} → σ → Lean.Elab.Term.StructInst.FieldVal σ
- default: {σ : Type} → Lean.Elab.Term.StructInst.FieldVal σ
Equations
- Lean.Elab.Term.StructInst.instInhabitedFieldVal = { default := Lean.Elab.Term.StructInst.FieldVal.term default }
- ref : Lean.Syntax
Equations
- Lean.Elab.Term.StructInst.instInhabitedField = { default := { ref := default, lhs := default, val := default, expr? := default } }
Equations
- Lean.Elab.Term.StructInst.Field.isSimple _fun_discr = match _fun_discr with | { ref := ref, lhs := [head], val := val, expr? := expr? } => true | x => false
Equations
- Lean.Elab.Term.StructInst.instInhabitedStruct = { default := Lean.Elab.Term.StructInst.Struct.mk default default default default default }
Equations
- Lean.Elab.Term.StructInst.Struct.ref _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Struct.mk ref structName params fields source => ref
Equations
- Lean.Elab.Term.StructInst.Struct.structName _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Struct.mk ref structName params fields source => structName
Equations
- Lean.Elab.Term.StructInst.Struct.params _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Struct.mk ref structName params fields source => params
Equations
- Lean.Elab.Term.StructInst.Struct.fields _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Struct.mk ref structName params fields source => fields
Equations
- Lean.Elab.Term.StructInst.Struct.source _fun_discr = match _fun_discr with | Lean.Elab.Term.StructInst.Struct.mk ref structName params fields s => s
true
iff all fields of the given structure are marked as default
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Elab.Term.StructInst.instToStringStruct = { toString := toString ∘ Lean.format }
Equations
- Lean.Elab.Term.StructInst.instToStringFieldStruct = { toString := toString ∘ Lean.format }
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
- Lean.Elab.Term.StructInst.Struct.setFields s fields = Lean.Elab.Term.StructInst.Struct.modifyFields s fun x => fields
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.
- ctorFn : Lean.Expr
- ctorFnType : Lean.Expr
- instMVars : Array Lean.MVarId
Equations
- Lean.Elab.Term.StructInst.markDefaultMissing e = Lean.mkAnnotation `structInstDefault e
Equations
- Lean.Elab.Term.StructInst.defaultMissing? e = Lean.annotation? `structInstDefault e
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.
- structs : Array Lean.Elab.Term.StructInst.Struct
Consider the following example:
structure A where x : Nat := 1 structure B extends A where y : Nat := x + 1 x := y + 1 structure C extends B where z : Nat := 2*y x := z + 3
And we are trying to elaborate a structure instance for
C
. There are default values forx
atA
,B
, andC
. We say the default value atC
has distance 0, the one atB
distance 1, and the one atA
distance 2. The fieldmaxDistance
specifies the maximum distance considered in a round of Default field computation. Remark: sinceC
does not set a default value ofy
, the default value atB
is at distance 0.The fixpoint for setting default values works in the following way.
- Keep computing default values using
maxDistance == 0
. - We increase
maxDistance
whenever we failed to compute a new default value in a round. - If
maxDistance > 0
, then we interrupt a round as soon as we compute some default value. We use depth-first search. - We sign an error if no progress is made when
maxDistance
== structure hierarchy depth (2 in the example above).
maxDistance : Nat- Keep computing default values using
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.
Reduce default value. It performs beta reduction and projections of the given structures.
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.
Structure instance. { x := e, ... }
assigns e
to field x
, which may be
inherited. If e
is itself a variable called x
, it can be elided:
fun y => { x := 1, y }
.
A structure update of an existing value can be given via with
:
{ point with x := 1 }
.
The structure type can be specified if not inferable:
{ x := 1, y := 2 : Point }
.
Equations
- One or more equations did not get rendered due to their size.