lift tactic #
This file defines the lift tactic, allowing the user to lift elements from one type to another
under a specified condition.
Tags #
lift, tactic
instance
Pi.canLift
(ι : Sort u_1)
(α : ι → Sort u_2)
(β : ι → Sort u_3)
(coe : (i : ι) → β i → α i)
(P : (i : ι) → α i → Prop)
[∀ (i : ι), CanLift (α i) (β i) (coe i) (P i)]
:
CanLift ((i : ι) → α i) ((i : ι) → β i) (fun (f : (i : ι) → β i) (i : ι) => coe i (f i)) fun (f : (i : ι) → α i) =>
∀ (i : ι), P i (f i)
Enable automatic handling of pi types in CanLift.
Lift an expression to another type.
- Usage:
'lift' expr 'to' expr ('using' expr)? ('with' id (id id?)?)?. - If
n : ℤandhn : n ≥ 0then the tacticlift n to ℕ using hncreates a new constant of typeℕ, also namednand replaces all occurrences of the old variable(n : ℤ)with↑n(wherenin the new variable). It will removenandhnfrom the context.- So for example the tactic
lift n to ℕ using hntransforms the goaln : ℤ, hn : n ≥ 0, h : P n ⊢ n = 3ton : ℕ, h : P ↑n ⊢ ↑n = 3(herePis some term of typeℤ → Prop).
- So for example the tactic
- The argument
using hnis optional, the tacticlift n to ℕdoes the same, but also creates a new subgoal thatn ≥ 0(wherenis the old variable). This subgoal will be placed at the top of the goal list.- So for example the tactic
lift n to ℕtransforms the goaln : ℤ, h : P n ⊢ n = 3to two goalsn : ℤ, h : P n ⊢ n ≥ 0andn : ℕ, h : P ↑n ⊢ ↑n = 3.
- So for example the tactic
- You can also use
lift n to ℕ using ewhereeis any expression of typen ≥ 0. - Use
lift n to ℕ with kto specify the name of the new variable. - Use
lift n to ℕ with k hkto also specify the name of the equality↑k = n. In this case,nwill remain in the context. You can userflfor the name ofhkto substitutenaway (i.e. the default behavior). - You can also use
lift e to ℕ with k hkwhereeis any expression of typeℤ. In this case, thehkwill always stay in the context, but it will be used to rewriteein all hypotheses and the target.- So for example the tactic
lift n + 3 to ℕ using hn with k hktransforms the goaln : ℤ, hn : n + 3 ≥ 0, h : P (n + 3) ⊢ n + 3 = 2 * nto the goaln : ℤ, k : ℕ, hk : ↑k = n + 3, h : P ↑k ⊢ ↑k = 2 * n.
- So for example the tactic
- The tactic
lift n to ℕ using hwill removehfrom the context. If you want to keep it, specify it again as the third argument towith, like this:lift n to ℕ using h with n rfl h. - More generally, this can lift an expression from
αtoβassuming that there is an instance ofCanLift α β. In this case the proof obligation is specified byCanLift.prf. - Given an instance
CanLift β γ, it can also liftα → βtoα → γ; more generally, givenβ : Π a : α, Type*,γ : Π a : α, Type*, and[Π a : α, CanLift (β a) (γ a)], it automatically generates an instanceCanLift (Π a, β a) (Π a, γ a).
lift is in some sense dual to the zify tactic. lift (z : ℤ) to ℕ will change the type of an
integer z (in the supertype) to ℕ (the subtype), given a proof that z ≥ 0;
propositions concerning z will still be over ℤ. zify changes propositions about ℕ (the
subtype) to propositions about ℤ (the supertype), without changing the type of any variable.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Generate instance for the lift tactic.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Mathlib.Tactic.Lift.main
(e t : Lean.TSyntax `term)
(hUsing : Option (Lean.TSyntax `term))
(newVarName newEqName : Option (Lean.TSyntax `ident))
(keepUsing : Bool)
:
Main function for the lift tactic.
Equations
- One or more equations did not get rendered due to their size.