statement
stringlengths
1
2.88k
proof
stringlengths
0
13.9k
type
stringclasses
10 values
symbolic_name
stringlengths
1
131
library
stringclasses
417 values
filename
stringlengths
17
80
imports
listlengths
0
16
deps
listlengths
0
64
docstring
stringlengths
0
10.2k
source_url
stringclasses
1 value
commit
stringclasses
1 value
congr_rule (congr : expr) (cs : list (list expr → old_conv unit)) : old_conv unit
λr lhs, do meta_rhs ← infer_type lhs >>= mk_meta_var, -- is maybe overly restricted for `heq` t ← mk_app r [lhs, meta_rhs], ((), meta_pr) ← solve_aux t (do apply congr, focus $ cs.map $ λc, (do xs ← intros, conversion (head_beta >> c xs)), done), rhs ← instantiate_mvars meta_rhs, pr ← ...
def
old_conv.congr_rule
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
congr_binder (congr : name) (cs : expr → old_conv unit) : old_conv unit
do e ← mk_const congr, congr_rule e [λbs, do [b] ← return bs, cs b]
def
old_conv.congr_binder
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
funext' : (expr → old_conv unit) → old_conv unit
congr_binder ``_root_.funext
def
old_conv.funext'
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
propext' {α : Type} (c : old_conv α) : old_conv α
λr lhs, (do guard (r = `iff), c r lhs) <|> (do guard (r = `eq), ⟨res, rhs, pr⟩ ← c `iff lhs, match pr with | some pr := return ⟨res, rhs, (expr.const `propext [] : expr) lhs rhs pr⟩ | none := return ⟨res, rhs, none⟩ end)
def
old_conv.propext'
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply (pr : expr) : old_conv unit
λ r e, do sl ← simp_lemmas.mk.add pr, apply_lemmas sl r e
def
old_conv.apply
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
applyc (n : name) : old_conv unit
λ r e, do sl ← simp_lemmas.mk.add_simp n, apply_lemmas sl r e
def
old_conv.applyc
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply' (n : name) : old_conv unit
do e ← mk_const n, congr_rule e []
def
old_conv.apply'
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim
(match_binder : expr → tactic (expr × expr)) -- returns the bound type and body (adapt_rel : old_conv unit → old_conv unit) -- optionally adapt `eq` to `iff` (apply_comm : old_conv unit) -- apply commutativity rule (apply_congr : (expr → old_conv unit) → old_conv unit) -- appl...
structure
binder_eq_elim
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim.check_eq (b : binder_eq_elim) (x : expr) : expr → tactic unit
| `(@eq %%β %%l %%r) := guard ((l = x ∧ ¬ x.occurs r) ∨ (r = x ∧ ¬ x.occurs l)) | _ := fail "no match"
def
binder_eq_elim.check_eq
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim.pull (b : binder_eq_elim) (x : expr) : old_conv unit
do (β, f) ← lhs >>= (lift_tactic ∘ b.match_binder), guard (¬ x.occurs β) <|> b.check_eq x β <|> (do b.apply_congr $ λx, binder_eq_elim.pull, b.apply_comm)
def
binder_eq_elim.pull
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim.push (b : binder_eq_elim) : old_conv unit
b.apply_elim_eq <|> (do b.apply_comm, b.apply_congr $ λx, binder_eq_elim.push) <|> (do b.apply_congr $ b.pull, binder_eq_elim.push)
def
binder_eq_elim.push
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim.check (b : binder_eq_elim) (x : expr) : expr → tactic unit
| e := do (β, f) ← b.match_binder e, b.check_eq x β <|> (do (lam n bi d bd) ← return f, x ← mk_local' n bi d, binder_eq_elim.check $ bd.instantiate_var x)
def
binder_eq_elim.check
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
binder_eq_elim.old_conv (b : binder_eq_elim) : old_conv unit
do (β, f) ← lhs >>= (lift_tactic ∘ b.match_binder), (lam n bi d bd) ← return f, x ← mk_local' n bi d, b.check x (bd.instantiate_var x), b.adapt_rel b.push
def
binder_eq_elim.old_conv
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
{u v} exists_elim_eq_left {α : Sort u} (a : α) (p : Π(a':α), a' = a → Prop) : (∃(a':α)(h : a' = a), p a' h) ↔ p a rfl
⟨λ⟨a', ⟨h, p_h⟩⟩, match a', h, p_h with ._, rfl, h := h end, λh, ⟨a, rfl, h⟩⟩
theorem
exists_elim_eq_left
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
{u v} exists_elim_eq_right {α : Sort u} (a : α) (p : Π(a':α), a = a' → Prop) : (∃(a':α)(h : a = a'), p a' h) ↔ p a rfl
⟨λ⟨a', ⟨h, p_h⟩⟩, match a', h, p_h with ._, rfl, h := h end, λh, ⟨a, rfl, h⟩⟩
theorem
exists_elim_eq_right
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
exists_eq_elim : binder_eq_elim
{ match_binder := λe, (do `(@Exists %%β %%f) ← return e, return (β, f)), adapt_rel := propext', apply_comm := applyc ``exists_comm, apply_congr := congr_binder ``exists_congr, apply_elim_eq := apply' ``exists_elim_eq_left <|> apply' ``exists_elim_eq_right }
def
exists_eq_elim
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "exists_comm", "exists_elim_eq_left", "exists_elim_eq_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
{u v} forall_comm {α : Sort u} {β : Sort v} (p : α → β → Prop) : (∀a b, p a b) ↔ (∀b a, p a b)
⟨assume h b a, h a b, assume h b a, h a b⟩
theorem
forall_comm
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
{u v} forall_elim_eq_left {α : Sort u} (a : α) (p : Π(a':α), a' = a → Prop) : (∀(a':α)(h : a' = a), p a' h) ↔ p a rfl
⟨λh, h a rfl, λh a' h_eq, match a', h_eq with ._, rfl := h end⟩
theorem
forall_elim_eq_left
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
{u v} forall_elim_eq_right {α : Sort u} (a : α) (p : Π(a':α), a = a' → Prop) : (∀(a':α)(h : a = a'), p a' h) ↔ p a rfl
⟨λh, h a rfl, λh a' h_eq, match a', h_eq with ._, rfl := h end⟩
theorem
forall_elim_eq_right
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
forall_eq_elim : binder_eq_elim
{ match_binder := λe, (do (expr.pi n bi d bd) ← return e, return (d, expr.lam n bi d bd)), adapt_rel := propext', apply_comm := applyc ``forall_comm, apply_congr := congr_binder ``forall_congr, apply_elim_eq := apply' ``forall_elim_eq_left <|> apply' ``forall_elim_eq_right }
def
forall_eq_elim
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "forall_comm", "forall_elim_eq_left", "forall_elim_eq_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
supr_eq_elim : binder_eq_elim
{ match_binder := λe, (do `(@supr %%α %%cl %%β %%f) ← return e, return (β, f)), adapt_rel := λc, (do r ← current_relation, guard (r = `eq), c), apply_comm := applyc ``supr_comm, apply_congr := congr_arg ∘ funext', apply_elim_eq := applyc ``supr_supr_eq_left <|> applyc ``supr_supr_eq_right }
def
supr_eq_elim
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "supr_comm", "supr_supr_eq_left", "supr_supr_eq_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
infi_eq_elim : binder_eq_elim
{ match_binder := λe, (do `(@infi %%α %%cl %%β %%f) ← return e, return (β, f)), adapt_rel := λc, (do r ← current_relation, guard (r = `eq), c), apply_comm := applyc ``infi_comm, apply_congr := congr_arg ∘ funext', apply_elim_eq := applyc ``infi_infi_eq_left <|> applyc ``infi_infi_eq_right }
def
infi_eq_elim
tactic.converter
src/tactic/converter/binders.lean
[ "order.complete_lattice" ]
[ "binder_eq_elim", "infi_comm", "infi_infi_eq_left", "infi_infi_eq_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
save_info (p : pos) : old_conv unit
λ r lhs, do ts ← tactic.read, -- TODO(Leo): include context tactic.save_info_thunk p (λ _, ts.format_expr lhs) >> return ⟨(), lhs, none⟩
def
old_conv.save_info
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
step {α : Type} (c : old_conv α) : old_conv unit
c >> return ()
def
old_conv.step
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
istep {α : Type} (line0 col0 line col : nat) (c : old_conv α) : old_conv unit
λ r lhs ts, (@scope_trace _ line col (λ _, (c >> return ()) r lhs ts)).clamp_pos line0 line col
def
old_conv.istep
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
execute (c : old_conv unit) : tactic unit
conversion c
def
old_conv.execute
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
itactic : Type
old_conv unit
def
old_conv.interactive.itactic
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
whnf : old_conv unit
old_conv.whnf
def
old_conv.interactive.whnf
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.whnf" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dsimp : old_conv unit
old_conv.dsimp
def
old_conv.interactive.dsimp
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.dsimp" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
trace_state : old_conv unit
old_conv.trace_lhs
def
old_conv.interactive.trace_state
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.trace_lhs" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
change (p : parse texpr) : old_conv unit
old_conv.change p
def
old_conv.interactive.change
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.change" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find (p : parse lean.parser.pexpr) (c : itactic) : old_conv unit
λ r lhs, do pat ← tactic.pexpr_to_pattern p, s ← simp_lemmas.mk_default, -- to be able to use congruence lemmas @[congr] (found, new_lhs, pr) ← tactic.ext_simplify_core ff {zeta := ff, beta := ff, single_pass := tt, eta := ff, proj := ff} s (λ u, return u) (λ found s r p e, do guar...
def
old_conv.interactive.find
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
replace_lhs (tac : expr → tactic (expr × expr)) : conv unit
do (e, pf) ← lhs >>= tac, update_lhs e pf
def
conv.replace_lhs
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
discharge_eq_lhs (tac : tactic unit) : conv unit
do pf ← lock_tactic_state (do m ← lhs >>= mk_meta_var, set_goals [m], tac >> done, instantiate_mvars m), congr, the_rhs ← rhs, update_lhs the_rhs pf, skip, skip
def
conv.discharge_eq_lhs
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
conv (t : conv.interactive.itactic) : conv unit
do transitivity, a :: rest ← get_goals, set_goals [a], t, all_goals reflexivity, set_goals rest
def
conv.interactive.conv
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
The `conv` tactic provides a `conv` within a `conv`. It allows the user to return to a previous state of the outer conv block to continue editing an expression without having to start a new conv block.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
erw (q : parse rw_rules) (cfg : rewrite_cfg := {md := semireducible}) : conv unit
rw q cfg
def
conv.interactive.erw
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
guard_target (p : parse texpr) : conv unit
do `(%%t = _) ← target, tactic.interactive.guard_expr_eq t p
def
conv.interactive.guard_target
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
`guard_target t` fails if the target of the conv goal is not `t`. We use this tactic for writing tests.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
old_conv (c : old_conv.interactive.itactic) : tactic unit
do t ← target, (new_t, pr) ← c.to_tactic `eq t, replace_target new_t pr
def
tactic.interactive.old_conv
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.interactive.itactic" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find (p : parse lean.parser.pexpr) (c : old_conv.interactive.itactic) : tactic unit
old_conv $ old_conv.interactive.find p c
def
tactic.interactive.find
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[ "old_conv", "old_conv.interactive.find", "old_conv.interactive.itactic" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
conv_lhs (loc : parse (tk "at" *> ident)?) (p : parse (tk "in" *> parser.pexpr)?) (c : conv.interactive.itactic) : tactic unit
conv loc p (conv.interactive.to_lhs >> c)
def
tactic.interactive.conv_lhs
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
conv_rhs (loc : parse (tk "at" *> ident)?) (p : parse (tk "in" *> parser.pexpr)?) (c : conv.interactive.itactic) : tactic unit
conv loc p (conv.interactive.to_rhs >> c)
def
tactic.interactive.conv_rhs
tactic.converter
src/tactic/converter/interactive.lean
[ "tactic.core", "tactic.converter.old_conv" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
old_conv_result (α : Type)
(val : α) (rhs : expr) (proof : option expr)
structure
old_conv_result
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
old_conv (α : Type) : Type
name → expr → tactic (old_conv_result α)
def
old_conv
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv_result" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lhs : old_conv expr
λ r e, return ⟨e, e, none⟩
def
old_conv.lhs
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
change (new_p : pexpr) : old_conv unit
λ r e, do e_type ← infer_type e, new_e ← to_expr ``(%%new_p : %%e_type), unify e new_e, return ⟨(), new_e, none⟩
def
old_conv.change
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
pure {α : Type} : α → old_conv α
λ a r e, return ⟨a, e, none⟩
def
old_conv.pure
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
join_proofs (r : name) (o₁ o₂ : option expr) : tactic (option expr)
match o₁, o₂ with | none, _ := return o₂ | _, none := return o₁ | some p₁, some p₂ := do env ← get_env, match env.trans_for r with | some trans := do pr ← mk_app trans [p₁, p₂], return $ some pr | none := fail format!"converter failed, relation '{r}' is not transitive" end end
def
old_conv.join_proofs
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
seq {α β : Type} (c₁ : old_conv (α → β)) (c₂ : old_conv α) : old_conv β
λ r e, do ⟨fn, e₁, pr₁⟩ ← c₁ r e, ⟨a, e₂, pr₂⟩ ← c₂ r e₁, pr ← join_proofs r pr₁ pr₂, return ⟨fn a, e₂, pr⟩
def
old_conv.seq
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
fail {α β : Type} [has_to_format β] (msg : β) : old_conv α
λ r e, tactic.fail msg
def
old_conv.fail
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
failed {α : Type} : old_conv α
λ r e, tactic.failed
def
old_conv.failed
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
orelse {α : Type} (c₁ : old_conv α) (c₂ : old_conv α) : old_conv α
λ r e, c₁ r e <|> c₂ r e
def
old_conv.orelse
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv", "orelse" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
map {α β : Type} (f : α → β) (c : old_conv α) : old_conv β
λ r e, do ⟨a, e₁, pr⟩ ← c r e, return ⟨f a, e₁, pr⟩
def
old_conv.map
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
bind {α β : Type} (c₁ : old_conv α) (c₂ : α → old_conv β) : old_conv β
λ r e, has_bind.bind (c₁ r e) (λ⟨a, e₁, pr₁⟩, has_bind.bind (c₂ a r e₁) (λ⟨b, e₂, pr₂⟩, has_bind.bind (join_proofs r pr₁ pr₂) (λpr, return ⟨b, e₂, pr⟩)))
def
old_conv.bind
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
whnf (md : transparency := reducible) : old_conv unit
λ r e, do n ← tactic.whnf e md, return ⟨(), n, none⟩
def
old_conv.whnf
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dsimp : old_conv unit
λ r e, do s ← simp_lemmas.mk_default, n ← s.dsimplify [] e, return ⟨(), n, none⟩
def
old_conv.dsimp
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
trace {α : Type} [has_to_tactic_format α] (a : α) : old_conv unit
λ r e, tactic.trace a >> return ⟨(), e, none⟩
def
old_conv.trace
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
trace_lhs : old_conv unit
lhs >>= trace
def
old_conv.trace_lhs
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_lemmas_core (s : simp_lemmas) (prove : tactic unit) : old_conv unit
λ r e, do (new_e, pr) ← s.rewrite e prove r, return ⟨(), new_e, some pr⟩
def
old_conv.apply_lemmas_core
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv", "prove" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_lemmas (s : simp_lemmas) : old_conv unit
apply_lemmas_core s failed
def
old_conv.apply_lemmas
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_propext_lemmas_core (s : simp_lemmas) (prove : tactic unit) : old_conv unit
λ r e, do guard (r = `eq), (new_e, pr) ← s.rewrite e prove `iff, new_pr ← mk_app `propext [pr], return ⟨(), new_e, some new_pr⟩
def
old_conv.apply_propext_lemmas_core
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv", "prove" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_propext_lemmas (s : simp_lemmas) : old_conv unit
apply_propext_lemmas_core s failed
def
old_conv.apply_propext_lemmas
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mk_refl_proof (r : name) (e : expr) : tactic expr
do env ← get_env, match (environment.refl_for env r) with | (some refl) := do pr ← mk_app refl [e], return pr | none := fail format!"converter failed, relation '{r}' is not reflexive" end
def
old_conv.mk_refl_proof
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_tactic (c : old_conv unit) : name → expr → tactic (expr × expr)
λ r e, do ⟨u, e₁, o⟩ ← c r e, match o with | none := do p ← mk_refl_proof r e, return (e₁, p) | some p := return (e₁, p) end
def
old_conv.to_tactic
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lift_tactic {α : Type} (t : tactic α) : old_conv α
λ r e, do a ← t, return ⟨a, e, none⟩
def
old_conv.lift_tactic
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_simp_set (attr_name : name) : old_conv unit
lift_tactic (get_user_simp_lemmas attr_name) >>= apply_lemmas
def
old_conv.apply_simp_set
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
apply_propext_simp_set (attr_name : name) : old_conv unit
lift_tactic (get_user_simp_lemmas attr_name) >>= apply_propext_lemmas
def
old_conv.apply_propext_simp_set
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
skip : old_conv unit
return ()
def
old_conv.skip
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
repeat : old_conv unit → old_conv unit
| c r lhs := (do ⟨_, rhs₁, pr₁⟩ ← c r lhs, guard (¬ lhs =ₐ rhs₁), ⟨_, rhs₂, pr₂⟩ ← repeat c r rhs₁, pr ← join_proofs r pr₁ pr₂, return ⟨(), rhs₂, pr⟩) <|> return ⟨(), lhs, none⟩
def
old_conv.repeat
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
first {α : Type} : list (old_conv α) → old_conv α
| [] := old_conv.failed | (c::cs) := c <|> first cs
def
old_conv.first
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv", "old_conv.failed" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
match_pattern (p : pattern) : old_conv unit
λ r e, tactic.match_pattern p e >> return ⟨(), e, none⟩
def
old_conv.match_pattern
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mk_match_expr (p : pexpr) : tactic (old_conv unit)
do new_p ← pexpr_to_pattern p, return (λ r e, tactic.match_pattern new_p e >> return ⟨(), e, none⟩)
def
old_conv.mk_match_expr
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
match_expr (p : pexpr) : old_conv unit
λ r e, do new_p ← pexpr_to_pattern p, tactic.match_pattern new_p e >> return ⟨(), e, none⟩
def
old_conv.match_expr
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
funext (c : old_conv unit) : old_conv unit
λ r lhs, do guard (r = `eq), (expr.lam n bi d b) ← return lhs, let aux_type := expr.pi n bi d (expr.const `true []), (result, _) ← solve_aux aux_type $ do { x ← intro1, c_result ← c r (b.instantiate_var x), let rhs := expr.lam n bi d (c_result.rhs.abstract x), match c_result.proof : _ → tactic (o...
def
old_conv.funext
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv", "old_conv_result" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
congr_core (c_f c_a : old_conv unit) : old_conv unit
λ r lhs, do guard (r = `eq), (expr.app f a) ← return lhs, f_type ← infer_type f >>= tactic.whnf, guard (f_type.is_arrow), ⟨(), new_f, of⟩ ← mtry c_f r f, ⟨(), new_a, oa⟩ ← mtry c_a r a, rhs ← return $ new_f new_a, match of, oa with | none, none := return ⟨(), rhs, none⟩ | none, some pr_a ...
def
old_conv.congr_core
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "mtry", "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
congr (c : old_conv unit) : old_conv unit
congr_core c c
def
old_conv.congr
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
bottom_up (c : old_conv unit) : old_conv unit
λ r e, do s ← simp_lemmas.mk_default, (a, new_e, pr) ← ext_simplify_core () {} s (λ u, return u) (λ a s r p e, failed) (λ a s r p e, do ⟨u, new_e, pr⟩ ← c r e, return ((), new_e, pr, tt)) r e, return ⟨(), new_e, some pr⟩
def
old_conv.bottom_up
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
top_down (c : old_conv unit) : old_conv unit
λ r e, do s ← simp_lemmas.mk_default, (a, new_e, pr) ← ext_simplify_core () {} s (λ u, return u) (λ a s r p e, do ⟨u, new_e, pr⟩ ← c r e, return ((), new_e, pr, tt)) (λ a s r p e, failed) r e, return ⟨(), new_e, some pr⟩
def
old_conv.top_down
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find (c : old_conv unit) : old_conv unit
λ r e, do s ← simp_lemmas.mk_default, (a, new_e, pr) ← ext_simplify_core () {} s (λ u, return u) (λ a s r p e, (do ⟨u, new_e, pr⟩ ← c r e, return ((), new_e, pr, ff)) <|> return ((), e, none, tt)) (λ a s r p e, failed) r e, return ⟨(), new_e, some pr⟩
def
old_conv.find
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_pattern (pat : pattern) (c : old_conv unit) : old_conv unit
λ r e, do s ← simp_lemmas.mk_default, (a, new_e, pr) ← ext_simplify_core () {} s (λ u, return u) (λ a s r p e, do matched ← (tactic.match_pattern pat e >> return tt) <|> return ff, if matched then do ⟨u, new_e, pr⟩ ← c r e, return ((), new_e, pr, ff) else retur...
def
old_conv.find_pattern
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
findp : pexpr → old_conv unit → old_conv unit
λ p c r e, do pat ← pexpr_to_pattern p, find_pattern pat c r e
def
old_conv.findp
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
conversion (c : old_conv unit) : tactic unit
do (r, lhs, rhs) ← (target_lhs_rhs <|> fail "conversion failed, target is not of the form 'lhs R rhs'"), (new_lhs, pr) ← to_tactic c r lhs, (unify new_lhs rhs <|> do new_lhs_fmt ← pp new_lhs, rhs_fmt ← pp rhs, fail (to_fmt "conversion failed, expected" ++ rhs_fmt....
def
old_conv.conversion
tactic.converter
src/tactic/converter/old_conv.lean
[ "control.basic" ]
[ "old_conv" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
linarith_trace {α} [has_to_tactic_format α] (s : α) : tactic unit
tactic.when_tracing `linarith (tactic.trace s)
def
linarith.linarith_trace
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
A shorthand for tracing when the `trace.linarith` option is set to true.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
linarith_trace_proofs (s : string := "") (l : list expr) : tactic unit
tactic.when_tracing `linarith $ do tactic.trace s, l.mmap tactic.infer_type >>= tactic.trace
def
linarith.linarith_trace_proofs
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
A shorthand for tracing the types of a list of proof terms when the `trace.linarith` option is set to true.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
linexp : Type
list (ℕ × ℤ)
def
linarith.linexp
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
A linear expression is a list of pairs of variable indices and coefficients, representing the sum of the products of each coefficient with its corresponding variable. Some functions on `linexp` assume that `n : ℕ` occurs at most once as the first element of a pair, and that the list is sorted in decreasing order of th...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add : linexp → linexp → linexp
| [] a := a | a [] := a | (a@(n1,z1)::t1) (b@(n2,z2)::t2) := if n1 < n2 then b::add (a::t1) t2 else if n2 < n1 then a::add t1 (b::t2) else let sum := z1 + z2 in if sum = 0 then add t1 t2 else (n1, sum)::add t1 t2
def
linarith.linexp.add
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
Add two `linexp`s together componentwise. Preserves sorting and uniqueness of the first argument.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
scale (c : ℤ) (l : linexp) : linexp
if c = 0 then [] else if c = 1 then l else l.map $ λ ⟨n, z⟩, (n, z*c)
def
linarith.linexp.scale
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`l.scale c` scales the values in `l` by `c` without modifying the order or keys.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
get (n : ℕ) : linexp → option ℤ
| [] := none | ((a, b)::t) := if a < n then none else if a = n then some b else get t
def
linarith.linexp.get
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`l.get n` returns the value in `l` associated with key `n`, if it exists, and `none` otherwise. This function assumes that `l` is sorted in decreasing order of the first argument, that is, it will return `none` as soon as it finds a key smaller than `n`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
contains (n : ℕ) : linexp → bool
option.is_some ∘ get n
def
linarith.linexp.contains
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`l.contains n` is true iff `n` is the first element of a pair in `l`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
zfind (n : ℕ) (l : linexp) : ℤ
match l.get n with | none := 0 | some v := v end
def
linarith.linexp.zfind
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`l.zfind n` returns the value associated with key `n` if there is one, and 0 otherwise.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
vars (l : linexp) : list ℕ
l.map prod.fst
def
linarith.linexp.vars
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`l.vars` returns the list of variables that occur in `l`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
cmp : linexp → linexp → ordering
| [] [] := ordering.eq | [] _ := ordering.lt | _ [] := ordering.gt | ((n1,z1)::t1) ((n2,z2)::t2) := if n1 < n2 then ordering.lt else if n2 < n1 then ordering.gt else if z1 < z2 then ordering.lt else if z2 < z1 then ordering.gt else cmp t1 t2
def
linarith.linexp.cmp
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
Defines a lex ordering on `linexp`. This function is performance critical.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
ineq : Type | eq | le | lt
inductive
linarith.ineq
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
The three-element type `ineq` is used to represent the strength of a comparison between terms.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
max : ineq → ineq → ineq
| lt a := lt | a lt := lt | le a := le | a le := le | eq eq := eq
def
linarith.ineq.max
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`max R1 R2` computes the strength of the sum of two inequalities. If `t1 R1 0` and `t2 R2 0`, then `t1 + t2 (max R1 R2) 0`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
cmp : ineq → ineq → ordering
| eq eq := ordering.eq | eq _ := ordering.lt | le le := ordering.eq | le lt := ordering.lt | lt lt := ordering.eq | _ _ := ordering.gt
def
linarith.ineq.cmp
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`ineq` is ordered `eq < le < lt`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_string : ineq → string
| eq := "=" | le := "≤" | lt := "<"
def
linarith.ineq.to_string
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
Prints an `ineq` as the corresponding infix symbol.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_const_mul_nm : ineq → name
| lt := ``mul_neg | le := ``mul_nonpos | eq := ``mul_eq
def
linarith.ineq.to_const_mul_nm
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[ "mul_neg" ]
Finds the name of a multiplicative lemma corresponding to an inequality strength.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
comp : Type
(str : ineq) (coeffs : linexp)
structure
linarith.comp
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
The main datatype for FM elimination. Variables are represented by natural numbers, each of which has an integer coefficient. Index 0 is reserved for constants, i.e. `coeffs.find 0` is the coefficient of 1. The represented term is `coeffs.sum (λ ⟨k, v⟩, v * Var[k])`. str determines the strength of the comparison -- is ...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
comp.vars : comp → list ℕ
linexp.vars ∘ comp.coeffs
def
linarith.comp.vars
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`c.vars` returns the list of variables that appear in the linear expression contained in `c`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
comp.coeff_of (c : comp) (a : ℕ) : ℤ
c.coeffs.zfind a
def
linarith.comp.coeff_of
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`comp.coeff_of c a` projects the coefficient of variable `a` out of `c`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
comp.scale (c : comp) (n : ℕ) : comp
{ c with coeffs := c.coeffs.scale n }
def
linarith.comp.scale
tactic.linarith
src/tactic/linarith/datatypes.lean
[ "tactic.linarith.lemmas", "tactic.ring" ]
[]
`comp.scale c n` scales the coefficients of `c` by `n`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83