Implementation of the @[ext]
attribute #
Meta code for creating ext theorems #
Constructs the hypotheses for the structure extensionality theorem that states that two structures are equal if their fields are equal.
Calls the continuation k
with the list of parameters to the structure,
two structure variables x
and y
, and a list of pairs (field, ty)
where each ty
is of the form x.field = y.field
or HEq x.field y.field
.
If flat
parses to true
, any fields inherited from parent structures
are treated as fields of the given structure type.
If it is false
, then the behind-the-scenes encoding of inherited fields
is visible in the extensionality lemma.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Creates the type of the extensionality theorem for the given structure,
returning ∀ {x y : Struct}, x.1 = y.1 → x.2 = y.2 → x = y
, for example.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Derives the type of the iff
form of an ext theorem.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Ensures that the given structure has an ext theorem, without validating any pre-existing theorems. Returns the name of the ext theorem.
See Lean.Elab.Tactic.Ext.withExtHyps
for an explanation of the flat
argument.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an 'ext' theorem, ensures that there is an iff version of the theorem (if possible), without validating any pre-existing theorems. Returns the name of the 'ext_iff' theorem.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Attribute #
Information about an extensionality theorem, stored in the environment extension.
- declName : Lake.Name
Declaration name of the extensionality theorem.
- priority : Nat
Priority of the extensionality theorem.
- keys : Array Lean.Meta.DiscrTree.Key
Key in the discrimination tree, for the type in which the extensionality theorem holds.
Instances For
Equations
- Lean.Elab.Tactic.Ext.instInhabitedExtTheorem = { default := { declName := default, priority := default, keys := default } }
Equations
The state of the ext
extension environment
The tree of
ext
extensions.- erased : Lean.PHashSet Lake.Name
Erased
ext
s viaattribute [-ext]
.
Instances For
Equations
- Lean.Elab.Tactic.Ext.instInhabitedExtTheorems = { default := { tree := default, erased := default } }
Discrimation tree settings for the ext
extension.
Equations
- Lean.Elab.Tactic.Ext.extExt.config = { iota := true, beta := true, proj := Lean.Meta.ProjReductionKind.yesWithDelta, zeta := true, zetaDelta := true }
Instances For
The environment extension to track @[ext]
theorems.
Gets the list of @[ext]
theorems corresponding to the key ty
,
ordered from high priority to low.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Erases a name marked ext
by adding it to the state's erased
field and
removing it from the state's list of Entry
s.
This is triggered by attribute [-ext] name
.
Equations
- d.eraseCore declName = { tree := d.tree, erased := Lean.PersistentHashSet.insert d.erased declName }
Instances For
Erases a name marked as a ext
attribute.
Check that it does in fact have the ext
attribute by making sure it names a ExtTheorem
found somewhere in the state's tree, and is not erased.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Implementation of ext
tactic #
Apply a single extensionality theorem to goal
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply a single extensionality theorem to the current goal.
Equations
Instances For
Postprocessor for withExt
which runs rintro
with the given patterns when the target is a
pi type.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Elab.Tactic.Ext.tryIntros g [] k = do let __do_lift ← liftM (liftM g.intros) k __do_lift.snd []
Instances For
Applies a single extensionality theorem, using pats
to introduce variables in the result.
Runs continuation k
on each subgoal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Applies extensionality theorems recursively, using pats
to introduce variables in the result.
Runs continuation k
on each subgoal.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Elab.Tactic.Ext.withExtN g pats k 0 failIfUnchanged = k g pats
Instances For
Apply extensionality theorems as much as possible, using pats
to introduce the variables
in extensionality theorems like funext
. Returns a list of subgoals.
This is built on top of withExtN
, running in TermElabM
to build the list of new subgoals.
(And, for each goal, the patterns consumed.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.