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 |
|---|---|---|---|---|---|---|---|---|---|---|
exprform.to_preform (xs : list expr) : exprform → tactic preform | | (exprform.eq xa xb) :=
do a ← xa.to_preterm xs,
b ← xb.to_preterm xs,
return (a =* b)
| (exprform.le xa xb) :=
do a ← xa.to_preterm xs,
b ← xb.to_preterm xs,
return (a ≤* b)
| (exprform.not xp) :=
do p ← xp.to_preform,
return ¬* p
| (exprform.or xp xq) :=
do p ← xp.to_pref... | def | omega.int.exprform.to_preform | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Reification to an intermediate shadow syntax which eliminates exprs,
but still includes non-canonical terms | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
to_preform (x : expr) : tactic (preform × nat) | do xf ← to_exprform x,
let xs := xf.exprs,
f ← xf.to_preform xs,
return (f, xs.length) | def | omega.int.to_preform | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Reification to an intermediate shadow syntax which eliminates exprs,
but still includes non-canonical terms. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove : tactic expr | do (p,m) ← target >>= to_preform,
trace_if_enabled `omega p,
prove_univ_close m p | def | omega.int.prove | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [
"prove",
"trace_if_enabled"
] | Return expr of proof of current LIA goal | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eq_int (x : expr) : tactic unit | if x = `(int) then skip else failed | def | omega.int.eq_int | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Succeed iff argument is the expr of ℤ | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
wff : expr → tactic unit | | `(¬ %%px) := wff px
| `(%%px ∨ %%qx) := wff px >> wff qx
| `(%%px ∧ %%qx) := wff px >> wff qx
| `(%%px ↔ %%qx) := wff px >> wff qx
| `(%%(expr.pi _ _ px qx)) :=
monad.cond
(if expr.has_var px then return tt else is_prop px)
(wff px >> wff qx)
(eq_int px >> wff qx)
| `(@has_lt.lt %%dx %%h _ _) :=... | def | omega.int.wff | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Check whether argument is expr of a well-formed formula of LIA | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
wfx (x : expr) : tactic unit | infer_type x >>= wff | def | omega.int.wfx | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Succeed iff argument is expr of term whose type is wff | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intro_ints_core : tactic unit | do x ← target,
match x with
| (expr.pi _ _ `(int) _) := intro_fresh >> intro_ints_core
| _ := skip
end | def | omega.int.intro_ints_core | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | Intro all universal quantifiers over ℤ | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intro_ints : tactic unit | do (expr.pi _ _ `(int) _) ← target,
intro_ints_core | def | omega.int.intro_ints | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preprocess : tactic unit | intro_ints <|> (revert_cond_all wfx >> desugar) | def | omega.int.preprocess | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [] | If the goal has universal quantifiers over integers, introduce all of them.
Otherwise, revert all hypotheses that are formulas of linear integer arithmetic. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
omega_int (is_manual : bool) : tactic unit | desugar ; (if is_manual then skip else preprocess) ; prove >>= apply >> skip | def | omega_int | tactic.omega.int | src/tactic/omega/int/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.int.dnf"
] | [
"prove"
] | The core omega tactic for integers. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
exprterm : Type
| cst : int → exprterm
| exp : int → expr → exprterm
| add : exprterm → exprterm → exprterm | inductive | omega.int.exprterm | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [
"exp"
] | The shadow syntax for arithmetic terms. All constants are reified to `cst`
(e.g., `-5` is reified to `cst -5`) and all other atomic terms are reified to
`exp` (e.g., `-5 * (gcd 14 -7)` is reified to `exp -5 \`(gcd 14 -7)`).
`exp` accepts a coefficient of type `int` as its first argument because
multiplication by consta... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preterm : Type
| cst : int → preterm
| var : int → nat → preterm
| add : preterm → preterm → preterm | inductive | omega.int.preterm | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | Similar to `exprterm`, except that all exprs are now replaced with
de Brujin indices of type `nat`. This is akin to generalizing over
the terms represented by the said exprs. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
val (v : nat → int) : preterm → int | | (& i) := i
| (i ** n) :=
if i = 1
then v n
else if i = -1
then -(v n)
else (v n) * i
| (t1 +* t2) := t1.val + t2.val | def | omega.int.preterm.val | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | Preterm evaluation | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fresh_index : preterm → nat | | (& _) := 0
| (i ** n) := n + 1
| (t1 +* t2) := max t1.fresh_index t2.fresh_index | def | omega.int.preterm.fresh_index | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | Fresh de Brujin index not used by any variable in argument | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
add_one (t : preterm) : preterm | t +* (&1) | def | omega.int.preterm.add_one | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
repr : preterm → string | | (& i) := i.repr
| (i ** n) := i.repr ++ "*x" ++ n.repr
| (t1 +* t2) := "(" ++ t1.repr ++ " + " ++ t2.repr ++ ")" | def | omega.int.preterm.repr | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
canonize : preterm → term | | (& i) := ⟨i, []⟩
| (i ** n) := ⟨0, [] {n ↦ i}⟩
| (t1 +* t2) := term.add (canonize t1) (canonize t2) | def | omega.int.canonize | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [] | Return a term (which is in canonical form by definition)
that is equivalent to the input preterm | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val_canonize {v : nat → int} :
∀ {t : preterm}, (canonize t).val v = t.val v | | (& i) :=
by simp only [preterm.val, add_zero, term.val, canonize, coeffs.val_nil]
| (i ** n) :=
begin
simp only [coeffs.val_set, canonize,
preterm.val, zero_add, term.val],
split_ifs with h1 h2,
{ simp only [one_mul, h1] },
{ simp only [neg_mul, one_mul, h2] },
{ rw mul_comm }
end
| ... | lemma | omega.int.val_canonize | tactic.omega.int | src/tactic/omega/int/preterm.lean | [
"tactic.omega.term"
] | [
"mul_comm",
"neg_mul",
"one_mul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
dnf_core : preform → list clause | | (p ∨* q) := (dnf_core p) ++ (dnf_core q)
| (p ∧* q) :=
(list.product (dnf_core p) (dnf_core q)).map
(λ pq, clause.append pq.fst pq.snd)
| (t =* s) :=
[([term.sub (canonize s) (canonize t)],[])]
| (t ≤* s) := [([],[term.sub (canonize s) (canonize t)])]
| (¬* _) := [] | def | omega.nat.dnf_core | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [
"list.product"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
exists_clause_holds_core {v : nat → nat} :
∀ {p : preform}, p.neg_free → p.sub_free → p.holds v →
∃ c ∈ (dnf_core p), clause.holds (λ x, ↑(v x)) c | begin
preform.induce `[intros h1 h0 h2],
{ apply list.exists_mem_cons_of,
constructor, rw list.forall_mem_singleton,
cases h0 with ht hs,
simp only [val_canonize ht, val_canonize hs,
term.val_sub, preform.holds, sub_eq_add_neg] at *,
rw [h2, add_neg_self], apply list.forall_mem_nil },
{ appl... | lemma | omega.nat.exists_clause_holds_core | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [
"int.coe_nat_le",
"list.exists_mem_cons_of",
"list.forall_mem_nil",
"list.forall_mem_singleton",
"list.mem_map",
"list.mem_product"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term.vars_core (is : list int) : list bool | is.map (λ i, if i = 0 then ff else tt) | def | omega.nat.term.vars_core | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term.vars (t : term) : list bool | term.vars_core t.snd | def | omega.nat.term.vars | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | Return a list of bools that encodes which variables have nonzero coefficients | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
bools.or : list bool → list bool → list bool | | [] bs2 := bs2
| bs1 [] := bs1
| (b1::bs1) (b2::bs2) := (b1 || b2)::(bools.or bs1 bs2) | def | omega.nat.bools.or | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
terms.vars : list term → list bool | | [] := []
| (t::ts) := bools.or (term.vars t) (terms.vars ts) | def | omega.nat.terms.vars | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | Return a list of bools that encodes which variables have nonzero coefficients in any one of the
input terms. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
nonneg_consts_core : nat → list bool → list term | | _ [] := []
| k (ff::bs) := nonneg_consts_core (k+1) bs
| k (tt::bs) := ⟨0, [] {k ↦ 1}⟩::nonneg_consts_core (k+1) bs | def | omega.nat.nonneg_consts_core | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nonneg_consts (bs : list bool) : list term | nonneg_consts_core 0 bs | def | omega.nat.nonneg_consts | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nonnegate : clause → clause | (eqs,les) | let xs := terms.vars eqs in
let ys := terms.vars les in
let bs := bools.or xs ys in
(eqs, nonneg_consts bs ++ les) | def | omega.nat.nonnegate | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
dnf (p : preform) : list clause | (dnf_core p).map nonnegate | def | omega.nat.dnf | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | DNF transformation | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
holds_nonneg_consts_core {v : nat → int} (h1 : ∀ x, 0 ≤ v x) :
∀ m bs, (∀ t ∈ (nonneg_consts_core m bs), 0 ≤ term.val v t) | | _ [] := λ _ h2, by cases h2
| k (ff::bs) := holds_nonneg_consts_core (k+1) bs
| k (tt::bs) :=
begin
simp only [nonneg_consts_core],
rw list.forall_mem_cons,
constructor,
{ simp only [term.val, one_mul, zero_add, coeffs.val_set],
apply h1 },
{ apply holds_nonneg_consts_core (k+1) bs }... | lemma | omega.nat.holds_nonneg_consts_core | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [
"list.forall_mem_cons",
"one_mul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
holds_nonneg_consts {v : nat → int} {bs : list bool} :
(∀ x, 0 ≤ v x) → (∀ t ∈ (nonneg_consts bs), 0 ≤ term.val v t) | | h1 :=
by apply holds_nonneg_consts_core h1 | lemma | omega.nat.holds_nonneg_consts | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
exists_clause_holds {v : nat → nat} {p : preform} :
p.neg_free → p.sub_free → p.holds v →
∃ c ∈ (dnf p), clause.holds (λ x, ↑(v x)) c | begin
intros h1 h2 h3,
rcases (exists_clause_holds_core h1 h2 h3) with ⟨c,h4,h5⟩,
existsi (nonnegate c),
have h6 : nonnegate c ∈ dnf p,
{ simp only [dnf], rw list.mem_map,
refine ⟨c,h4,rfl⟩ },
refine ⟨h6,_⟩, cases c with eqs les,
simp only [nonnegate, clause.holds],
constructor, apply h5.left,
rw ... | lemma | omega.nat.exists_clause_holds | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [
"int.coe_nat_nonneg",
"list.forall_mem_append",
"list.mem_map"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
exists_clause_sat {p : preform} :
p.neg_free → p.sub_free →
p.sat → ∃ c ∈ (dnf p), clause.sat c | begin
intros h1 h2 h3, cases h3 with v h3,
rcases (exists_clause_holds h1 h2 h3) with ⟨c,h4,h5⟩,
refine ⟨c,h4,_,h5⟩
end | lemma | omega.nat.exists_clause_sat | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unsat_of_unsat_dnf (p : preform) :
p.neg_free → p.sub_free → clauses.unsat (dnf p) → p.unsat | begin
intros hnf hsf h1 h2, apply h1,
apply exists_clause_sat hnf hsf h2
end | lemma | omega.nat.unsat_of_unsat_dnf | tactic.omega.nat | src/tactic/omega/nat/dnf.lean | [
"data.list.prod_sigma",
"tactic.omega.clause",
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
holds (v : nat → nat) : preform → Prop | | (t =* s) := t.val v = s.val v
| (t ≤* s) := t.val v ≤ s.val v
| (¬* p) := ¬ p.holds
| (p ∨* q) := p.holds ∨ q.holds
| (p ∧* q) := p.holds ∧ q.holds | def | omega.nat.preform.holds | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [] | Evaluate a preform into prop using the valuation `v`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
univ_close (p : preform) : (nat → nat) → nat → Prop | | v 0 := p.holds v
| v (k+1) := ∀ i : nat, univ_close (update_zero i v) k | def | omega.nat.univ_close | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [] | `univ_close p n` := `p` closed by prepending `n` universal quantifiers | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_free : preform → Prop | | (t =* s) := t.sub_free ∧ s.sub_free
| (t ≤* s) := t.sub_free ∧ s.sub_free
| (¬* p) := p.sub_free
| (p ∨* q) := p.sub_free ∧ q.sub_free
| (p ∧* q) := p.sub_free ∧ q.sub_free | def | omega.nat.preform.sub_free | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [] | Return expr of proof that argument is free of subtractions | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
holds_constant {v w : nat → nat} :
∀ p : preform,
( (∀ x < p.fresh_index, v x = w x) →
(p.holds v ↔ p.holds w) ) | | (t =* s) h1 :=
begin
simp only [holds],
apply pred_mono_2;
apply preterm.val_constant;
intros x h2; apply h1 _ (lt_of_lt_of_le h2 _),
apply le_max_left, apply le_max_right
end
| (t ≤* s) h1 :=
begin
simp only [holds],
apply pred_mono_2;
apply preterm.val_constant;
intros x h2... | lemma | omega.nat.preform.holds_constant | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
univ_close_of_valid {p : preform} :
∀ {m : nat} {v : nat → nat}, p.valid → univ_close p v m | | 0 v h1 := h1 _
| (m+1) v h1 := λ i, univ_close_of_valid h1 | lemma | omega.nat.univ_close_of_valid | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preform.induce (t : tactic unit := tactic.skip) : tactic unit | `[ intro p, induction p with t s t s p ih p q ihp ihq p q ihp ihq; t ] | def | omega.nat.preform.induce | tactic.omega.nat | src/tactic/omega/nat/form.lean | [
"tactic.omega.nat.preterm"
] | [
"ih"
] | Tactic for setting up proof by induction over preforms. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
desugar | `[try {simp only with sugar_nat at *}] | def | omega.nat.desugar | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
univ_close_of_unsat_neg_elim_not (m) (p : preform) :
(neg_elim (¬* p)).unsat → univ_close p (λ _, 0) m | begin
intro h1, apply univ_close_of_valid,
apply valid_of_unsat_not, intro h2, apply h1,
apply preform.sat_of_implies_of_sat implies_neg_elim h2,
end | lemma | omega.nat.univ_close_of_unsat_neg_elim_not | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preterm.prove_sub_free : preterm → tactic expr | | (& m) := return `(trivial)
| (m ** n) := return `(trivial)
| (t +* s) :=
do x ← preterm.prove_sub_free t,
y ← preterm.prove_sub_free s,
return `(@and.intro (preterm.sub_free %%`(t))
(preterm.sub_free %%`(s)) %%x %%y)
| (_ -* _) := failed | def | omega.nat.preterm.prove_sub_free | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Return expr of proof that argument is free of subtractions | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_neg_free : preform → tactic expr | | (t =* s) := return `(trivial)
| (t ≤* s) := return `(trivial)
| (p ∨* q) :=
do x ← prove_neg_free p,
y ← prove_neg_free q,
return `(@and.intro (preform.neg_free %%`(p))
(preform.neg_free %%`(q)) %%x %%y)
| (p ∧* q) :=
do x ← prove_neg_free p,
y ← prove_neg_free q,
return `(@and.intro (p... | def | omega.nat.prove_neg_free | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Return expr of proof that argument is free of negations | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_sub_free : preform → tactic expr | | (t =* s) :=
do x ← preterm.prove_sub_free t,
y ← preterm.prove_sub_free s,
return `(@and.intro (preterm.sub_free %%`(t))
(preterm.sub_free %%`(s)) %%x %%y)
| (t ≤* s) :=
do x ← preterm.prove_sub_free t,
y ← preterm.prove_sub_free s,
return `(@and.intro (preterm.sub_free %%`(t))
(... | def | omega.nat.prove_sub_free | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Return expr of proof that argument is free of subtractions | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_unsat_sub_free (p : preform) : tactic expr | do x ← prove_neg_free p,
y ← prove_sub_free p,
z ← prove_unsats (dnf p),
return `(unsat_of_unsat_dnf %%`(p) %%x %%y %%z) | def | omega.nat.prove_unsat_sub_free | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Given a p : preform, return the expr of a term t : p.unsat, where p is subtraction- and
negation-free. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_unsat_neg_free : preform → tactic expr | p | match p.sub_terms with
| none := prove_unsat_sub_free p
| (some (t,s)) :=
do x ← prove_unsat_neg_free (sub_elim t s p),
return `(unsat_of_unsat_sub_elim %%`(t) %%`(s) %%`(p) %%x)
end | def | omega.nat.prove_unsat_neg_free | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Given a p : preform, return the expr of a term t : p.unsat, where p is negation-free. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_univ_close (m : nat) (p : preform) : tactic expr | do x ← prove_unsat_neg_free (neg_elim (¬*p)),
to_expr ``(univ_close_of_unsat_neg_elim_not %%`(m) %%`(p) %%x) | def | omega.nat.prove_univ_close | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Given a (m : nat) and (p : preform), return the expr of (t : univ_close m p). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
to_exprterm : expr → tactic exprterm | | `(%%x * %%y) :=
do m ← eval_expr' nat y,
return (exprterm.exp m x)
| `(%%t1x + %%t2x) :=
do t1 ← to_exprterm t1x,
t2 ← to_exprterm t2x,
return (exprterm.add t1 t2)
| `(%%t1x - %%t2x) :=
do t1 ← to_exprterm t1x,
t2 ← to_exprterm t2x,
return (exprterm.sub t1 t2)
| x :=
( do m ← eval_exp... | def | omega.nat.to_exprterm | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Reification to imtermediate shadow syntax that retains exprs | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
to_exprform : expr → tactic exprform | | `(%%tx1 = %%tx2) :=
do t1 ← to_exprterm tx1,
t2 ← to_exprterm tx2,
return (exprform.eq t1 t2)
| `(%%tx1 ≤ %%tx2) :=
do t1 ← to_exprterm tx1,
t2 ← to_exprterm tx2,
return (exprform.le t1 t2)
| `(¬ %%px) := do p ← to_exprform px, return (exprform.not p)
| `(%%px ∨ %%qx) :=
do p ← to_exprform p... | def | omega.nat.to_exprform | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Reification to imtermediate shadow syntax that retains exprs | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
exprterm.exprs : exprterm → list expr | | (exprterm.cst _) := []
| (exprterm.exp _ x) := [x]
| (exprterm.add t s) := list.union t.exprs s.exprs
| (exprterm.sub t s) := list.union t.exprs s.exprs | def | omega.nat.exprterm.exprs | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | List of all unreified exprs | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
exprterm.to_preterm (xs : list expr) : exprterm → tactic preterm | | (exprterm.cst k) := return & k
| (exprterm.exp k x) :=
let m := xs.index_of x in
if m < xs.length
then return (k ** m)
else failed
| (exprterm.add xa xb) :=
do a ← xa.to_preterm,
b ← xb.to_preterm,
return (a +* b)
| (exprterm.sub xa xb) :=
do a ← xa.to_preterm,
b ← xb.to_preterm,
ret... | def | omega.nat.exprterm.to_preterm | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Reification to an intermediate shadow syntax which eliminates exprs,
but still includes non-canonical terms | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eq_nat (x : expr) : tactic unit | if x = `(nat) then skip else failed | def | omega.nat.eq_nat | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Succeed iff argument is expr of ℕ | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
wff : expr → tactic unit | | `(¬ %%px) := wff px
| `(%%px ∨ %%qx) := wff px >> wff qx
| `(%%px ∧ %%qx) := wff px >> wff qx
| `(%%px ↔ %%qx) := wff px >> wff qx
| `(%%(expr.pi _ _ px qx)) :=
monad.cond
(if expr.has_var px then return tt else is_prop px)
(wff px >> wff qx)
(eq_nat px >> wff qx)
| `(@has_lt.lt %%dx %%h _ _) :=... | def | omega.nat.wff | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Check whether argument is expr of a well-formed formula of LNA | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intro_nats_core : tactic unit | do x ← target,
match x with
| (expr.pi _ _ `(nat) _) := intro_fresh >> intro_nats_core
| _ := skip
end | def | omega.nat.intro_nats_core | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | Intro all universal quantifiers over nat | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intro_nats : tactic unit | do (expr.pi _ _ `(nat) _) ← target,
intro_nats_core | def | omega.nat.intro_nats | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preprocess : tactic unit | intro_nats <|> (revert_cond_all wfx >> desugar) | def | omega.nat.preprocess | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [] | If the goal has universal quantifiers over natural, introduce all of them.
Otherwise, revert all hypotheses that are formulas of linear natural number arithmetic. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
omega_nat (is_manual : bool) : tactic unit | desugar ; (if is_manual then skip else preprocess) ; prove >>= apply >> skip | def | omega_nat | tactic.omega.nat | src/tactic/omega/nat/main.lean | [
"tactic.omega.prove_unsats",
"tactic.omega.nat.dnf",
"tactic.omega.nat.neg_elim",
"tactic.omega.nat.sub_elim"
] | [
"prove"
] | The core omega tactic for natural numbers. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
push_neg_equiv :
∀ {p : preform}, preform.equiv (push_neg p) (¬* p) | begin
preform.induce `[intros v; try {refl}],
{ simp only [not_not, preform.holds, push_neg] },
{ simp only [preform.holds, push_neg, not_or_distrib, ihp v, ihq v] },
{ simp only [preform.holds, push_neg, not_and_distrib, ihp v, ihq v] }
end | lemma | omega.nat.push_neg_equiv | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [
"not_and_distrib",
"not_not",
"not_or_distrib"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
neg_elim_core : preform → preform | | (¬* (t =* s)) := (t.add_one ≤* s) ∨* (s.add_one ≤* t)
| (¬* (t ≤* s)) := s.add_one ≤* t
| (p ∨* q) := (neg_elim_core p) ∨* (neg_elim_core q)
| (p ∧* q) := (neg_elim_core p) ∧* (neg_elim_core q)
| p := p | def | omega.nat.neg_elim_core | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
neg_free_neg_elim_core : ∀ p, is_nnf p → (neg_elim_core p).neg_free | begin
preform.induce `[intro h1, try {simp only [neg_free, neg_elim_core]}, try {trivial}],
{ cases p; try {cases h1}; try {trivial},
constructor; trivial },
{ cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption },
{ cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption }
end | lemma | omega.nat.neg_free_neg_elim_core | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
implies_neg_elim_core : ∀ {p : preform},
preform.implies p (neg_elim_core p) | begin
preform.induce `[intros v h, try {apply h}],
{ cases p with t s t s; try {apply h},
{ apply or.symm,
simpa only [preform.holds, le_and_le_iff_eq.symm,
not_and_distrib, not_le] using h },
simpa only [preform.holds, not_le, int.add_one_le_iff] using h },
{ simp only [neg_elim_core], case... | lemma | omega.nat.implies_neg_elim_core | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [
"int.add_one_le_iff",
"not_and_distrib"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
neg_elim : preform → preform | neg_elim_core ∘ nnf | def | omega.nat.neg_elim | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [] | Eliminate all negations in a preform | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
neg_free_neg_elim {p : preform} : (neg_elim p).neg_free | neg_free_neg_elim_core _ (is_nnf_nnf _) | lemma | omega.nat.neg_free_neg_elim | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
implies_neg_elim {p : preform} : preform.implies p (neg_elim p) | begin
intros v h1, apply implies_neg_elim_core,
apply (nnf_equiv v).elim_right h1
end | lemma | omega.nat.implies_neg_elim | tactic.omega.nat | src/tactic/omega/nat/neg_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
exprterm : Type
| cst : nat → exprterm
| exp : nat → expr → exprterm
| add : exprterm → exprterm → exprterm
| sub : exprterm → exprterm → exprterm | inductive | omega.nat.exprterm | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [
"exp"
] | The shadow syntax for arithmetic terms. All constants are reified to `cst`
(e.g., `5` is reified to `cst 5`) and all other atomic terms are reified to
`exp` (e.g., `5 * (list.length l)` is reified to `exp 5 \`(list.length l)`).
`exp` accepts a coefficient of type `nat` as its first argument because
multiplication by co... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
preterm : Type
| cst : nat → preterm
| var : nat → nat → preterm
| add : preterm → preterm → preterm
| sub : preterm → preterm → preterm | inductive | omega.nat.preterm | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Similar to `exprterm`, except that all exprs are now replaced with
de Brujin indices of type `nat`. This is akin to generalizing over
the terms represented by the said exprs. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
induce (tac : tactic unit := tactic.skip) : tactic unit | `[ intro t, induction t with m m n t s iht ihs t s iht ihs; tac] | def | omega.nat.preterm.induce | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Helper tactic for proof by induction over preterms | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val (v : nat → nat) : preterm → nat | | (& i) := i
| (i ** n) :=
if i = 1
then v n
else (v n) * i
| (t1 +* t2) := t1.val + t2.val
| (t1 -* t2) := t1.val - t2.val | def | omega.nat.preterm.val | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Preterm evaluation | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val_const {v : nat → nat} {m : nat} :
(& m).val v = m | rfl | lemma | omega.nat.preterm.val_const | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
val_var {v : nat → nat} {m n : nat} :
(m ** n).val v = m * (v n) | begin
simp only [val], by_cases h1 : m = 1,
rw [if_pos h1, h1, one_mul],
rw [if_neg h1, mul_comm],
end | lemma | omega.nat.preterm.val_var | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [
"mul_comm",
"one_mul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
val_add {v : nat → nat} {t s : preterm} :
(t +* s).val v = t.val v + s.val v | rfl | lemma | omega.nat.preterm.val_add | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
val_sub {v : nat → nat} {t s : preterm} :
(t -* s).val v = t.val v - s.val v | rfl | lemma | omega.nat.preterm.val_sub | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
fresh_index : preterm → nat | | (& _) := 0
| (i ** n) := n + 1
| (t1 +* t2) := max t1.fresh_index t2.fresh_index
| (t1 -* t2) := max t1.fresh_index t2.fresh_index | def | omega.nat.preterm.fresh_index | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Fresh de Brujin index not used by any variable in argument | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val_constant (v w : nat → nat) :
∀ t : preterm, (∀ x < t.fresh_index, v x = w x) →
t.val v = t.val w | | (& n) h1 := rfl
| (m ** n) h1 :=
begin
simp only [val_var],
apply congr_arg (λ y, m * y),
apply h1 _ (lt_add_one _)
end
| (t +* s) h1 :=
begin
simp only [val_add],
have ht := val_constant t
(λ x hx, h1 _ (lt_of_lt_of_le hx (le_max_left _ _))),
have hs := val_constant s
... | lemma | omega.nat.preterm.val_constant | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [
"lt_add_one"
] | If variable assignments `v` and `w` agree on all variables that occur
in term `t`, the value of `t` under `v` and `w` are identical. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
repr : preterm → string | | (& i) := i.repr
| (i ** n) := i.repr ++ "*x" ++ n.repr
| (t1 +* t2) := "(" ++ t1.repr ++ " + " ++ t2.repr ++ ")"
| (t1 -* t2) := "(" ++ t1.repr ++ " - " ++ t2.repr ++ ")" | def | omega.nat.preterm.repr | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sub_free : preterm → Prop | | (& m) := true
| (m ** n) := true
| (t +* s) := t.sub_free ∧ s.sub_free
| (_ -* _) := false | def | omega.nat.preterm.sub_free | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Preterm is free of subtractions | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
canonize : preterm → term | | (& m) := ⟨↑m, []⟩
| (m ** n) := ⟨0, [] {n ↦ ↑m}⟩
| (t +* s) := term.add (canonize t) (canonize s)
| (_ -* _) := ⟨0, []⟩ | def | omega.nat.canonize | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | Return a term (which is in canonical form by definition)
that is equivalent to the input preterm | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val_canonize {v : nat → nat} :
∀ {t : preterm}, t.sub_free →
(canonize t).val (λ x, ↑(v x)) = t.val v | | (& i) h1 :=
by simp only [canonize, preterm.val_const,
term.val, coeffs.val_nil, add_zero]
| (i ** n) h1 :=
by simp only [preterm.val_var, coeffs.val_set,
term.val, zero_add, int.coe_nat_mul, canonize]
| (t +* s) h1 :=
by simp only [val_canonize h1.left,
val_canonize h1.right, int.coe_nat_add,
... | lemma | omega.nat.val_canonize | tactic.omega.nat | src/tactic/omega/nat/preterm.lean | [
"tactic.omega.term"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sub_terms : preterm → option (preterm × preterm) | | (& i) := none
| (i ** n) := none
| (t +* s) := t.sub_terms <|> s.sub_terms
| (t -* s) := t.sub_terms <|> s.sub_terms <|> some (t,s) | def | omega.nat.preterm.sub_terms | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Find subtraction inside preterm and return its operands | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_subst (t s : preterm) (k : nat) : preterm → preterm | | t@(& m) := t
| t@(m ** n) := t
| (x +* y) := x.sub_subst +* y.sub_subst
| (x -* y) :=
if x = t ∧ y = s then (1 ** k)
else x.sub_subst -* y.sub_subst | def | omega.nat.preterm.sub_subst | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Find (t - s) inside a preterm and replace it with variable k | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
val_sub_subst {k : nat} {x y : preterm} {v : nat → nat} :
∀ {t : preterm}, t.fresh_index ≤ k →
(sub_subst x y k t).val (update k (x.val v - y.val v) v) = t.val v | | (& m) h1 := rfl
| (m ** n) h1 :=
begin
have h2 : n ≠ k := ne_of_lt h1,
simp only [sub_subst, preterm.val],
rw update_eq_of_ne _ h2,
end
| (t +* s) h1 :=
begin
simp only [sub_subst, val_add], apply fun_mono_2;
apply val_sub_subst (le_trans _ h1),
apply le_max_left, apply le_max_right
... | lemma | omega.nat.preterm.val_sub_subst | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [
"one_mul",
"update"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sub_terms : preform → option (preterm × preterm) | | (t =* s) := t.sub_terms <|> s.sub_terms
| (t ≤* s) := t.sub_terms <|> s.sub_terms
| (¬* p) := p.sub_terms
| (p ∨* q) := p.sub_terms <|> q.sub_terms
| (p ∧* q) := p.sub_terms <|> q.sub_terms | def | omega.nat.preform.sub_terms | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Find subtraction inside preform and return its operands | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_subst (x y : preterm) (k : nat) : preform → preform | | (t =* s) := preterm.sub_subst x y k t =* preterm.sub_subst x y k s
| (t ≤* s) := preterm.sub_subst x y k t ≤* preterm.sub_subst x y k s
| (¬* p) := ¬* p.sub_subst
| (p ∨* q) := p.sub_subst ∨* q.sub_subst
| (p ∧* q) := p.sub_subst ∧* q.sub_subst | def | omega.nat.preform.sub_subst | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Find (t - s) inside a preform and replace it with variable k | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
is_diff (t s : preterm) (k : nat) : preform | ((t =* (s +* (1 ** k))) ∨* (t ≤* s ∧* ((1 ** k) =* &0))) | def | omega.nat.is_diff | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Preform which asserts that the value of variable k is
the truncated difference between preterms t and s | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
holds_is_diff {t s : preterm} {k : nat} {v : nat → nat} :
v k = t.val v - s.val v → (is_diff t s k).holds v | begin
intro h1,
simp only [preform.holds, is_diff, if_pos (eq.refl 1),
preterm.val_add, preterm.val_var, preterm.val_const],
cases le_total (t.val v) (s.val v) with h2 h2,
{ right, refine ⟨h2, _⟩,
rw [h1, one_mul, tsub_eq_zero_iff_le], exact h2 },
{ left, rw [h1, one_mul, add_comm, tsub_add_cancel_of_... | lemma | omega.nat.holds_is_diff | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [
"one_mul",
"tsub_add_cancel_of_le",
"tsub_eq_zero_iff_le"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sub_elim_core (t s : preterm) (k : nat) (p : preform) : preform | (preform.sub_subst t s k p) ∧* (is_diff t s k) | def | omega.nat.sub_elim_core | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Helper function for sub_elim | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_fresh_index (t s : preterm) (p : preform) : nat | max p.fresh_index (max t.fresh_index s.fresh_index) | def | omega.nat.sub_fresh_index | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Return de Brujin index of fresh variable that does not occur
in any of the arguments | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_elim (t s : preterm) (p : preform) : preform | sub_elim_core t s (sub_fresh_index t s p) p | def | omega.nat.sub_elim | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | Return a new preform with all subtractions eliminated | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sub_subst_equiv {k : nat} {x y : preterm} {v : nat → nat} :
∀ p : preform, p.fresh_index ≤ k → ((preform.sub_subst x y k p).holds
(update k (x.val v - y.val v) v) ↔ (p.holds v)) | | (t =* s) h1 :=
begin
simp only [preform.holds, preform.sub_subst],
apply pred_mono_2;
apply preterm.val_sub_subst (le_trans _ h1),
apply le_max_left, apply le_max_right
end
| (t ≤* s) h1 :=
begin
simp only [preform.holds, preform.sub_subst],
apply pred_mono_2;
apply preterm.val_sub_s... | lemma | omega.nat.sub_subst_equiv | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [
"update"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
sat_sub_elim {t s : preterm} {p : preform} :
p.sat → (sub_elim t s p).sat | begin
intro h1, simp only [sub_elim, sub_elim_core],
cases h1 with v h1,
refine ⟨update (sub_fresh_index t s p) (t.val v - s.val v) v, _⟩,
constructor,
{ apply (sub_subst_equiv p _).elim_right h1,
apply le_max_left },
{ apply holds_is_diff, rw update_eq,
apply fun_mono_2;
apply preterm.val_const... | lemma | omega.nat.sat_sub_elim | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unsat_of_unsat_sub_elim (t s : preterm) (p : preform) :
(sub_elim t s p).unsat → p.unsat | mt sat_sub_elim | lemma | omega.nat.unsat_of_unsat_sub_elim | tactic.omega.nat | src/tactic/omega/nat/sub_elim.lean | [
"tactic.omega.nat.form"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
side
| L
| R | inductive | side | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | ||
side.other : side → side | | side.L := side.R
| side.R := side.L | def | side.other | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [
"side"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
side.to_string : side → string | | side.L := "L"
| side.R := "R" | def | side.to_string | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [
"side"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tracked_rewrite | (exp : expr)
(proof : tactic expr)
-- If `addr` is not provided by the underlying implementation of `rewrite_all` (i.e. kabstract)
-- `rewrite_search` will not be able to produce tactic scripts.
(addr : option (list side)) | structure | tactic.rewrite_all.tracked_rewrite | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [
"exp",
"side"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
replace_target (rw : tracked_rewrite) : tactic unit | do (exp, prf) ← rw.eval,
tactic.replace_target exp prf | def | tactic.rewrite_all.tracked_rewrite.replace_target | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [
"exp"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
replace_target_side (new_target lam : pexpr) (prf : expr) : tactic unit | do new_target ← to_expr new_target tt ff,
prf' ← to_expr ``(congr_arg %%lam %%prf) tt ff,
tactic.replace_target new_target prf' | def | tactic.rewrite_all.tracked_rewrite.replace_target_side | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
replace_target_lhs (rw : tracked_rewrite) : tactic unit | do (new_lhs, prf) ← rw.eval,
`(%%_ = %%rhs) ← target,
replace_target_side ``(%%new_lhs = %%rhs) ``(λ L, L = %%rhs) prf | def | tactic.rewrite_all.tracked_rewrite.replace_target_lhs | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
replace_target_rhs (rw : tracked_rewrite) : tactic unit | do (new_rhs, prf) ← rw.eval,
`(%%lhs = %%_) ← target,
replace_target_side ``(%%lhs = %%new_rhs) ``(λ R, %%lhs = R) prf | def | tactic.rewrite_all.tracked_rewrite.replace_target_rhs | tactic.rewrite_all | src/tactic/rewrite_all/basic.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rules_from_exprs (l : list expr) : list (expr × bool) | l.map (λ e, (e, ff)) ++ l.map (λ e, (e, tt)) | def | tactic.rewrite_search.rules_from_exprs | tactic.rewrite_search | src/tactic/rewrite_search/discovery.lean | [
"tactic.nth_rewrite",
"tactic.rewrite_search.types"
] | [] | Convert a list of expressions into a list of rules. The difference is that a rule
includes a flag for direction, so this simply includes each expression twice,
once in each direction. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.