Extending have, let and suffices #
This file extends the have, let and suffices tactics to allow the addition of hypotheses to
the context without requiring their proofs to be provided immediately.
As a style choice, this should not be used in mathlib; but is provided for downstream users who preferred the old style.
A parser for optional binder identifiers
Equations
- One or more equations did not get rendered due to their size.
Instances For
Retrieves the name of the optional identifier, if provided. Returns this otherwise
Equations
Instances For
The have tactic is for adding opaque definitions and hypotheses to the local context of the main goal.
The definitions forget their associated value and cannot be unfolded, unlike definitions added by the let tactic.
have h : t := eadds the hypothesish : tifeis a term of typet.have h := euses the type ofefort.have : t := eandhave := eusethisfor the name of the hypothesis.have pat := efor a patternpatis equivalent tomatch e with | pat => _, where_stands for the tactics that follow this one. It is convenient for types that have only one applicable constructor. For example, givenh : p ∧ q ∧ r,have ⟨h₁, h₂, h₃⟩ := hproduces the hypothesesh₁ : p,h₂ : q, andh₃ : r.- The syntax
have (eq := h) pat := eis equivalent tomatch h : e with | pat => _, which adds the equationh : e = patto the local context.
The tactic supports all the same syntax variants and options as the have term.
Properties and relations #
- It is not possible to unfold a variable introduced using
have, since the definition's value is forgotten. Thelettactic introduces definitions that can be unfolded. - The
have h : t := eis like doinglet h : t := e; clear_value h. - The
havetactic is preferred for propositions, andletis preferred for non-propositions. - Sometimes
haveis used for non-propositions to ensure that the variable is never unfolded, which may be important for performance reasons. Consider using the equivalentlet +nondepto indicate the intent.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The let tactic is for adding definitions to the local context of the main goal.
The definition can be unfolded, unlike definitions introduced by have.
let x : t := eadds the definitionx : t := eifeis a term of typet.let x := euses the type ofefort.let : t := eandlet := eusethisfor the name of the hypothesis.let pat := efor a patternpatis equivalent tomatch e with | pat => _, where_stands for the tactics that follow this one. It is convenient for types that let only one applicable constructor. For example, givenp : α × β × γ,let ⟨x, y, z⟩ := pproduces the local variablesx : α,y : β, andz : γ.- The syntax
let (eq := h) pat := eis equivalent tomatch h : e with | pat => _, which adds the equationh : e = patto the local context.
The tactic supports all the same syntax variants and options as the let term.
Properties and relations #
- Unlike
have, it is possible to unfold definitions introduced usinglet, using tactics such assimp,dsimp,unfold, andsubst. - The
clear_valuetactic turns aletdefinition into ahavedefinition after the fact. The tactic might fail if the local context depends on the value of the variable. - The
lettactic is preferred for data (non-propositions). - Sometimes
haveis used for non-propositions to ensure that the variable is never unfolded, which may be important for performance reasons.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a main goal ctx ⊢ t, suffices h : t' from e replaces the main goal with ctx ⊢ t',
e must have type t in the context ctx, h : t'.
The variant suffices h : t' by tac is a shorthand for suffices h : t' from by tac.
If h : is omitted, the name this is used.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Adds hypotheses to the context, turning them into goals to be proved later if their proof terms
aren't provided (t: Option Term := none).
If the bound term is intended to be kept in the context, pass keepTerm : Bool := true. This is
useful when extending the let tactic, which is expected to show the proof term in the infoview.
Equations
- One or more equations did not get rendered due to their size.