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
factor (i : int) (t : term) : eqelim term
if i ∣ t.fst then add_ee (ee.factor i) >> pure (t.div i) else abort
def
omega.factor
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
Divide a term by an integer if the integer divides the constant component of the term. It is assumed that the integer also divides all coefficients of the term.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_min_coeff_core : list int → eqelim (int × nat)
| [] := abort | (i::is) := (do (j,n) ← find_min_coeff_core is, if i ≠ 0 ∧ i.nat_abs ≤ j.nat_abs then pure (i,0) else pure (j,n+1)) <|> (if i = (0 : int) then abort else pure (i,0))
def
omega.find_min_coeff_core
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
If list has a nonzero element, return the minimum element (by absolute value) with its index. Otherwise, return none.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_min_coeff (t : term) : eqelim (int × nat × term)
do (i,n) ← find_min_coeff_core t.snd, if 0 < i then pure (i,n,t) else add_ee (ee.neg) >> pure (-i,n,t.neg)
def
omega.find_min_coeff
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
Find and return the smallest coefficient (by absolute value) in a term, along with the coefficient's variable index and the term itself. If the coefficient is negative, negate both the coefficient and the term before returning them.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
elim_eq : eqelim unit
do t ← head_eq, i ← get_gcd t, factor i t !>>= (set_eqs [] >> add_ee (ee.nondiv i)); λ s, find_min_coeff s !>>= add_ee ee.drop; λ ⟨i, n, u⟩, if i = 1 then do eqs ← get_eqs, les ← get_les, set_eqs (eqs.map (cancel n u)), set_les (les.map (cancel n u)), add_ee (ee.can...
def
omega.elim_eq
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
Find an appropriate equality elimination step for the current state and apply it.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
elim_eqs : eqelim (list ee)
elim_eq !>>= get_ees; λ _, elim_eqs
def
omega.elim_eqs
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
Find and return the sequence of steps for eliminating all equality constraints in the current state.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_ees : clause → tactic (list ee)
| (eqs, les) := run eqs les elim_eqs
def
omega.find_ees
tactic.omega
src/tactic/omega/find_ees.lean
[ "tactic.omega.eq_elim" ]
[]
Given a linear constrain clause, return a list of steps for eliminating its equality constraints.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
trisect (m : nat) : list (list nat × term) → (list (list nat × term) × list (list nat × term) × list (list nat × term))
| [] := ([],[],[]) | ((p,t)::pts) := let (neg,zero,pos) := trisect pts in if get m t.snd < 0 then ((p,t)::neg,zero,pos) else if get m t.snd = 0 then (neg,(p,t)::zero,pos) else (neg,zero,(p,t)::pos)
def
omega.trisect
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[]
Divide linear combinations into three groups by the coefficient of the `m`th variable in their resultant terms: negative, zero, or positive.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
elim_var_aux (m : nat) : ((list nat × term) × (list nat × term)) → tactic (list nat × term)
| ((p1,t1), (p2,t2)) := let n := int.nat_abs (get m t1.snd) in let o := int.nat_abs (get m t2.snd) in let lcm := (nat.lcm n o) in let n' := lcm / n in let o' := lcm / o in return (add (p1.map ((*) n')) (p2.map ((*) o')), term.add (t1.mul n') (t2.mul o'))
def
omega.elim_var_aux
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[]
Use two linear combinations to obtain a third linear combination whose resultant term does not include the `m`th variable.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
elim_var (m : nat) (neg pos : list (list nat × term)) : tactic (list (list nat × term))
let pairs := list.product neg pos in monad.mapm (elim_var_aux m) pairs
def
omega.elim_var
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[ "list.product" ]
Use two lists of linear combinations (one in which the resultant terms include occurrences of the `m`th variable with positive coefficients, and one with negative coefficients) and linearly combine them in every possible way that eliminates the `m`th variable.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_neg_const : list (list nat × term) → tactic (list nat)
| [] := tactic.failed | ((π,⟨c,_⟩)::l) := if c < 0 then return π else find_neg_const l
def
omega.find_neg_const
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[]
Search through a list of (linear combination × resultant term) pairs, find the first pair whose resultant term has a negative constant term, and return its linear combination
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_scalars_core : nat → list (list nat × term) → tactic (list nat)
| 0 pts := find_neg_const pts | (m+1) pts := let (neg,zero,pos) := trisect m pts in do new ← elim_var m neg pos, find_scalars_core m (new ++ zero)
def
omega.find_scalars_core
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[]
First, eliminate all variables by Fourier–Motzkin elimination. When all variables have been eliminated, find and return the linear combination which produces a constraint of the form `0 < k + t` such that `k` is the constant term of the RHS and `k < 0`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
find_scalars (ts : list term) : tactic (list nat)
find_scalars_core (ts.map (λ t : term, t.snd.length)).maximum.iget (ts.map_with_index (λ m t, (list.func.set 1 [] m, t)))
def
omega.find_scalars
tactic.omega
src/tactic/omega/find_scalars.lean
[ "tactic.omega.term", "data.list.min_max" ]
[ "list.func.set" ]
Perform Fourier–Motzkin elimination to find a contradictory linear combination of input constraints.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lin_comb : list nat → list term → term
| [] [] := ⟨0,[]⟩ | [] (_::_) := ⟨0,[]⟩ | (_::_) [] := ⟨0,[]⟩ | (n::ns) (t::ts) := term.add (t.mul ↑n) (lin_comb ns ts)
def
omega.lin_comb
tactic.omega
src/tactic/omega/lin_comb.lean
[ "tactic.omega.clause" ]
[]
Linear combination of constraints. The second argument is the list of constraints, and the first argument is the list of conefficients by which the constraints are multiplied
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lin_comb_holds {v : nat → int} : ∀ {ts} ns, (∀ t ∈ ts, 0 ≤ term.val v t) → (0 ≤ (lin_comb ns ts).val v)
| [] [] h := by simp only [add_zero, term.val, lin_comb, coeffs.val_nil] | [] (_::_) h := by simp only [add_zero, term.val, lin_comb, coeffs.val_nil] | (_::_) [] h := by simp only [add_zero, term.val, lin_comb, coeffs.val_nil] | (t::ts) (n::ns) h := begin have : 0 ≤ ↑n * term.val v t + term.val v (lin_comb ns...
lemma
omega.lin_comb_holds
tactic.omega
src/tactic/omega/lin_comb.lean
[ "tactic.omega.clause" ]
[ "int.coe_nat_nonneg", "list.forall_mem_of_forall_mem_cons" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
unsat_lin_comb (ns : list nat) (ts : list term) : Prop
(lin_comb ns ts).fst < 0 ∧ ∀ x ∈ (lin_comb ns ts).snd, x = (0 : int)
def
omega.unsat_lin_comb
tactic.omega
src/tactic/omega/lin_comb.lean
[ "tactic.omega.clause" ]
[]
`unsat_lin_comb ns ts` asserts that the linear combination `lin_comb ns ts` is unsatisfiable
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
unsat_lin_comb_of (ns : list nat) (ts : list term) : (lin_comb ns ts).fst < 0 → (∀ x ∈ (lin_comb ns ts).snd, x = (0 : int)) → unsat_lin_comb ns ts
by {intros h1 h2, exact ⟨h1,h2⟩}
lemma
omega.unsat_lin_comb_of
tactic.omega
src/tactic/omega/lin_comb.lean
[ "tactic.omega.clause" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
unsat_of_unsat_lin_comb (ns : list nat) (ts : list term) : (unsat_lin_comb ns ts) → clause.unsat ([], ts)
begin intros h1 h2, cases h2 with v h2, have h3 := lin_comb_holds ns h2.right, cases h1 with hl hr, cases (lin_comb ns ts) with b as, unfold term.val at h3, rw [coeffs.val_eq_zero hr, add_zero, ← not_lt] at h3, apply h3 hl end
lemma
omega.unsat_of_unsat_lin_comb
tactic.omega
src/tactic/omega/lin_comb.lean
[ "tactic.omega.clause" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
select_domain (t s : tactic (option bool)) : tactic (option bool)
do a ← t, b ← s, match a, b with | a, none := return a | none, b := return b | (some tt), (some tt) := return (some tt) | (some ff), (some ff) := return (some ff) | _, _ := failed end
def
omega.select_domain
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
type_domain (x : expr) : tactic (option bool)
if x = `(int) then return (some tt) else if x = `(nat) then return (some ff) else failed
def
omega.type_domain
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
form_domain : expr → tactic (option bool)
| `(¬ %%px) := form_domain px | `(%%px ∨ %%qx) := select_domain (form_domain px) (form_domain qx) | `(%%px ∧ %%qx) := select_domain (form_domain px) (form_domain qx) | `(%%px ↔ %%qx) := select_domain (form_domain px) (form_domain qx) | `(%%(expr.pi _ _ px qx)) := monad.cond (if expr.has_var px then return t...
def
omega.form_domain
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[]
Detects domain of a formula from its expr. * Returns none, if domain can be either ℤ or ℕ * Returns some tt, if domain is exclusively ℤ * Returns some ff, if domain is exclusively ℕ * Fails, if domain is neither ℤ nor ℕ
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
goal_domain_aux (x : expr) : tactic bool
(omega.int.wff x >> return tt) <|> (omega.nat.wff x >> return ff)
def
omega.goal_domain_aux
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[ "omega.int.wff", "omega.nat.wff" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
goal_domain : tactic bool
do gx ← target, hxs ← local_context >>= monad.mapm infer_type, app_first goal_domain_aux (gx::hxs)
def
omega.goal_domain
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[]
Use the current goal to determine. Return tt if the domain is ℤ, and return ff if it is ℕ
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
determine_domain (opt : list name) : tactic bool
if `int ∈ opt then return tt else if `nat ∈ opt then return ff else goal_domain
def
omega.determine_domain
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[]
Return tt if the domain is ℤ, and return ff if it is ℕ
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
tactic.interactive.omega (opt : parse (many ident)) : tactic unit
do is_int ← determine_domain opt, let is_manual : bool := if `manual ∈ opt then tt else ff, if is_int then omega_int is_manual else omega_nat is_manual
def
tactic.interactive.omega
tactic.omega
src/tactic/omega/main.lean
[ "tactic.omega.int.main", "tactic.omega.nat.main" ]
[ "omega_int", "omega_nat" ]
Attempts to discharge goals in the quantifier-free fragment of linear integer and natural number arithmetic using the Omega test. Guesses the correct domain by looking at the goal and hypotheses, and then reverts all relevant hypotheses and variables. Use `omega manual` to disable automatic reverts, and `omega int` or ...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
fun_mono_2 {p : α → β → γ} {a1 a2 : α} {b1 b2 : β} : a1 = a2 → b1 = b2 → (p a1 b1 = p a2 b2)
λ h1 h2, by rw [h1, h2]
lemma
omega.fun_mono_2
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
pred_mono_2 {p : α → β → Prop} {a1 a2 : α} {b1 b2 : β} : a1 = a2 → b1 = b2 → (p a1 b1 ↔ p a2 b2)
λ h1 h2, by rw [h1, h2]
lemma
omega.pred_mono_2
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
pred_mono_2' {c : Prop → Prop → Prop} {a1 a2 b1 b2 : Prop} : (a1 ↔ a2) → (b1 ↔ b2) → (c a1 b1 ↔ c a2 b2)
λ h1 h2, by rw [h1, h2]
lemma
omega.pred_mono_2'
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
update (m : nat) (a : α) (v : nat → α) : nat → α
| n := if n = m then a else v n
def
omega.update
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[ "update" ]
Update variable assignment for a specific variable and leave everything else unchanged
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
update_eq (m : nat) (a : α) (v : nat → α) : (v ⟨m ↦ a⟩) m = a
by simp only [update, if_pos rfl]
lemma
omega.update_eq
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[ "update" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
update_eq_of_ne {m : nat} {a : α} {v : nat → α} (k : nat) : k ≠ m → update m a v k = v k
by {intro h1, unfold update, rw if_neg h1}
lemma
omega.update_eq_of_ne
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[ "update" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
update_zero (a : α) (v : nat → α) : nat → α
| 0 := a | (k+1) := v k
def
omega.update_zero
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
Assign a new value to the zeroth variable, and push all other assignments up by 1
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
intro_fresh : tactic unit
do n ← mk_fresh_name, intro n, skip
def
omega.intro_fresh
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
Intro with a fresh name
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
revert_cond (t : expr → tactic unit) (x : expr) : tactic unit
(t x >> revert x >> skip) <|> skip
def
omega.revert_cond
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
Revert an expr if it passes the given test
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
revert_cond_all (t : expr → tactic unit) : tactic unit
do hs ← local_context, mmap (revert_cond t) hs, skip
def
omega.revert_cond_all
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
Revert all exprs in the context that pass the given test
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
app_first {α β : Type} (t : α → tactic β) : list α → tactic β
| [] := failed | (a :: as) := t a <|> app_first as
def
omega.app_first
tactic.omega
src/tactic/omega/misc.lean
[ "tactic.localized" ]
[]
Try applying a tactic to each of the element in a list until success, and return the first successful result
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_neg : int → tactic expr
| (int.of_nat _) := failed | -[1+ m] := return `(int.neg_succ_lt_zero %%`(m))
def
omega.prove_neg
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Return expr of proof that given int is negative
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
forall_mem_replicate_zero_eq_zero (m : nat) : (∀ x ∈ (list.replicate m (0 : int)), x = (0 : int))
λ x, list.eq_of_mem_replicate
lemma
omega.forall_mem_replicate_zero_eq_zero
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[ "list.eq_of_mem_replicate", "list.replicate" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_forall_mem_eq_zero (is : list int) : tactic expr
return `(forall_mem_replicate_zero_eq_zero is.length)
def
omega.prove_forall_mem_eq_zero
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Return expr of proof that elements of (replicate is.length 0) are all 0
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_unsat_lin_comb (ks : list nat) (ts : list term) : tactic expr
let ⟨b,as⟩ := lin_comb ks ts in do x1 ← prove_neg b, x2 ← prove_forall_mem_eq_zero as, to_expr ``(unsat_lin_comb_of %%`(ks) %%`(ts) %%x1 %%x2)
def
omega.prove_unsat_lin_comb
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Return expr of proof that the combination of linear constraints represented by ks and ts is unsatisfiable
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_unsat_ef : clause → tactic expr
| ((_::_), _) := failed | ([], les) := do ks ← find_scalars les, x ← prove_unsat_lin_comb ks les, return `(unsat_of_unsat_lin_comb %%`(ks) %%`(les) %%x)
def
omega.prove_unsat_ef
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Given a (([],les) : clause), return the expr of a term (t : clause.unsat ([],les)).
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_unsat (c : clause) : tactic expr
do ee ← find_ees c, x ← prove_unsat_ef (eq_elim ee c), return `(unsat_of_unsat_eq_elim %%`(ee) %%`(c) %%x)
def
omega.prove_unsat
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Given a (c : clause), return the expr of a term (t : clause.unsat c)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_unsats : list clause → tactic expr
| [] := return `(clauses.unsat_nil) | (p::ps) := do x ← prove_unsat p, xs ← prove_unsats ps, to_expr ``(clauses.unsat_cons %%`(p) %%`(ps) %%x %%xs)
def
omega.prove_unsats
tactic.omega
src/tactic/omega/prove_unsats.lean
[ "tactic.omega.find_ees", "tactic.omega.find_scalars", "tactic.omega.lin_comb" ]
[]
Given a (cs : list clause), return the expr of a term (t : clauses.unsat cs)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
term : Type
int × list int
def
omega.term
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
Shadow syntax of normalized terms. The first element represents the constant term and the list represents the coefficients.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val (v : nat → int) : term → int
| (b,as) := b + coeffs.val v as
def
omega.term.val
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
Evaluate a term using the valuation v.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg : term → term
| (b,as) := (-b, list.func.neg as)
def
omega.term.neg
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[ "list.func.neg" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add : term → term → term
| (c1,cfs1) (c2,cfs2) := (c1+c2, list.func.add cfs1 cfs2)
def
omega.term.add
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[ "list.func.add" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sub : term → term → term
| (c1,cfs1) (c2,cfs2) := (c1 - c2, list.func.sub cfs1 cfs2)
def
omega.term.sub
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[ "list.func.sub" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul (i : int) : term → term
| (b,as) := (i * b, as.map ((*) i))
def
omega.term.mul
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div (i : int) : term → term
| (b,as) := (b/i, as.map (λ x, x / i))
def
omega.term.div
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_neg {v : nat → int} {t : term} : (neg t).val v = -(t.val v)
begin cases t with b as, simp only [val, neg_add, neg, val, coeffs.val_neg] end
lemma
omega.term.val_neg
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_sub {v : nat → int} {t1 t2 : term} : (sub t1 t2).val v = t1.val v - t2.val v
begin cases t1, cases t2, simp only [add_assoc, coeffs.val_sub, neg_add_rev, val, sub, add_comm, add_left_comm, sub_eq_add_neg] end
lemma
omega.term.val_sub
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_add {v : nat → int} {t1 t2 : term} : (add t1 t2).val v = t1.val v + t2.val v
begin cases t1, cases t2, simp only [coeffs.val_add, add, val, add_comm, add_left_comm] end
lemma
omega.term.val_add
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_mul {v : nat → int} {i : int} {t : term} : val v (mul i t) = i * (val v t)
begin cases t, simp only [mul, mul_add, add_mul, list.length_map, coeffs.val, coeffs.val_between_map_mul, val, list.map] end
lemma
omega.term.val_mul
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
val_div {v : nat → int} {i b : int} {as : list int} : i ∣ b → (∀ x ∈ as, i ∣ x) → (div i (b,as)).val v = (val v (b,as)) / i
begin intros h1 h2, simp only [val, div, list.map], rw [int.add_div_of_dvd_left h1], apply fun_mono_2 rfl, rw ← coeffs.val_map_div h2 end
lemma
omega.term.val_div
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[ "int.add_div_of_dvd_left" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
fresh_index (t : term) : nat
t.snd.length
def
omega.term.fresh_index
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
Fresh de Brujin index not used by any variable ocurring in the term
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_string (t : term) : string
t.2.enum.foldr (λ ⟨i, n⟩ r, to_string n ++ " * x" ++ to_string i ++ " + " ++ r) (to_string t.1)
def
omega.term.to_string
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
terms.fresh_index : list term → nat
| [] := 0 | (t::ts) := max t.fresh_index (terms.fresh_index ts)
def
omega.terms.fresh_index
tactic.omega
src/tactic/omega/term.lean
[ "tactic.omega.coeffs" ]
[]
Fresh de Brujin index not used by any variable ocurring in the list of terms
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
push_neg : preform → preform
| (p ∨* q) := (push_neg p) ∧* (push_neg q) | (p ∧* q) := (push_neg p) ∨* (push_neg q) | (¬*p) := p | p := ¬* p
def
omega.int.push_neg
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
push_neg p returns the result of normalizing ¬ p by pushing the outermost negation all the way down, until it reaches either a negation or an atom
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, push_neg, preform.holds] }, { 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.int.push_neg_equiv
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "not_and_distrib", "not_not", "not_or_distrib" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nnf : preform → preform
| (¬* p) := push_neg (nnf p) | (p ∨* q) := (nnf p) ∨* (nnf q) | (p ∧* q) := (nnf p) ∧* (nnf q) | a := a
def
omega.int.nnf
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
NNF transformation
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
is_nnf : preform → Prop
| (t =* s) := true | (t ≤* s) := true | ¬*(t =* s) := true | ¬*(t ≤* s) := true | (p ∨* q) := is_nnf p ∧ is_nnf q | (p ∧* q) := is_nnf p ∧ is_nnf q | _ := false
def
omega.int.is_nnf
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
is_nnf_push_neg : ∀ p : preform, is_nnf p → is_nnf (push_neg p)
begin preform.induce `[intro h1; try {trivial}], { cases p; try {cases h1}; trivial }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption }, { cases h1, constructor; [{apply ihp}, {apply ihq}]; assumption } end
lemma
omega.int.is_nnf_push_neg
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_free : preform → Prop
| (t =* s) := true | (t ≤* s) := true | (p ∨* q) := neg_free p ∧ neg_free q | (p ∧* q) := neg_free p ∧ neg_free q | _ := false
def
omega.int.neg_free
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
Argument is free of negations
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
is_nnf_nnf : ∀ p : preform, is_nnf (nnf p)
begin preform.induce `[try {trivial}], { apply is_nnf_push_neg _ ih }, { constructor; assumption }, { constructor; assumption } end
lemma
omega.int.is_nnf_nnf
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "ih" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nnf_equiv : ∀ {p : preform}, preform.equiv (nnf p) p
begin preform.induce `[intros v; try {refl}; simp only [nnf]], { rw push_neg_equiv, apply not_iff_not_of_iff, apply ih }, { apply pred_mono_2' (ihp v) (ihq v) }, { apply pred_mono_2' (ihp v) (ihq v) } end
lemma
omega.int.nnf_equiv
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "ih" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_elim : preform → preform
| (¬* (t =* s)) := (t.add_one ≤* s) ∨* (s.add_one ≤* t) | (¬* (t ≤* s)) := s.add_one ≤* t | (p ∨* q) := (neg_elim p) ∨* (neg_elim q) | (p ∧* q) := (neg_elim p) ∧* (neg_elim q) | p := p
def
omega.int.neg_elim
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
Eliminate all negations from preform
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
neg_free_neg_elim : ∀ p : preform, is_nnf p → neg_free (neg_elim p)
begin preform.induce `[intro h1, try {simp only [neg_free, neg_elim]}, 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.int.neg_free_neg_elim
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_and_le_iff_eq {α : Type} [partial_order α] {a b : α} : (a ≤ b ∧ b ≤ a) ↔ a = b
begin constructor; intro h1, { cases h1, apply le_antisymm; assumption }, { constructor; apply le_of_eq; rw h1 } end
lemma
omega.int.le_and_le_iff_eq
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
implies_neg_elim : ∀ {p : preform}, preform.implies p (neg_elim p)
begin preform.induce `[intros v h, try {apply h}], { cases p with t s t s; try {apply h}, { simp only [le_and_le_iff_eq.symm, not_and_distrib, not_le, preterm.val, preform.holds] at h, simp only [int.add_one_le_iff, preterm.add_one, preterm.val, preform.holds, neg_elim], rw o...
lemma
omega.int.implies_neg_elim
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "int.add_one_le_iff", "not_and_distrib" ]
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.int.dnf_core
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "list.product" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
dnf (p : preform) : list clause
dnf_core $ neg_elim $ nnf p
def
omega.int.dnf
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
DNF transformation
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
exists_clause_holds {v : nat → int} : ∀ {p : preform}, neg_free p → p.holds v → ∃ c ∈ (dnf_core p), clause.holds v c
begin preform.induce `[intros h1 h2], { apply list.exists_mem_cons_of, constructor, { simp only [preterm.val, preform.holds] at h2, rw [list.forall_mem_singleton], simp only [h2, omega.int.val_canonize, omega.term.val_sub, sub_self] }, { apply list.forall_mem_nil } }, { apply list.exis...
lemma
omega.int.exists_clause_holds
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[ "list.exists_mem_cons_of", "list.forall_mem_nil", "list.forall_mem_singleton", "list.mem_map", "list.mem_product", "omega.int.val_canonize", "omega.term.val_sub" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clauses_sat_dnf_core {p : preform} : neg_free p → p.sat → clauses.sat (dnf_core p)
begin intros h1 h2, cases h2 with v h2, rcases (exists_clause_holds h1 h2) with ⟨c,h3,h4⟩, refine ⟨c,h3,v,h4⟩ end
lemma
omega.int.clauses_sat_dnf_core
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
unsat_of_clauses_unsat {p : preform} : clauses.unsat (dnf p) → p.unsat
begin intros h1 h2, apply h1, apply clauses_sat_dnf_core, apply neg_free_neg_elim _ (is_nnf_nnf _), apply preform.sat_of_implies_of_sat implies_neg_elim, have hrw := exists_congr (@nnf_equiv p), apply hrw.elim_right h2 end
lemma
omega.int.unsat_of_clauses_unsat
tactic.omega.int
src/tactic/omega/int/dnf.lean
[ "data.list.prod_sigma", "tactic.omega.clause", "tactic.omega.int.form" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
exprform | eq : exprterm → exprterm → exprform | le : exprterm → exprterm → exprform | not : exprform → exprform | or : exprform → exprform → exprform | and : exprform → exprform → exprform
inductive
omega.int.exprform
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
Intermediate shadow syntax for LNA formulas that includes unreified exprs
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
preform | eq : preterm → preterm → preform | le : preterm → preterm → preform | not : preform → preform | or : preform → preform → preform | and : preform → preform → preform
inductive
omega.int.preform
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
Intermediate shadow syntax for LIA formulas that includes non-canonical terms
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
holds (v : nat → int) : 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.int.preform.holds
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
Evaluate a preform into prop using the valuation v.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
univ_close (p : preform) : (nat → int) → nat → Prop
| v 0 := p.holds v | v (k+1) := ∀ i : int, univ_close (update_zero i v) k
def
omega.int.univ_close
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
univ_close p n := p closed by prepending n universal quantifiers
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
fresh_index : preform → nat
| (t =* s) := max t.fresh_index s.fresh_index | (t ≤* s) := max t.fresh_index s.fresh_index | (¬* p) := p.fresh_index | (p ∨* q) := max p.fresh_index q.fresh_index | (p ∧* q) := max p.fresh_index q.fresh_index
def
omega.int.preform.fresh_index
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
Fresh de Brujin index not used by any variable in argument
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
valid (p : preform) : Prop
∀ v, holds v p
def
omega.int.preform.valid
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
All valuations satisfy argument
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sat (p : preform) : Prop
∃ v, holds v p
def
omega.int.preform.sat
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
There exists some valuation that satisfies argument
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
implies (p q : preform) : Prop
∀ v, (holds v p → holds v q)
def
omega.int.preform.implies
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
implies p q := under any valuation, q holds if p holds
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
equiv (p q : preform) : Prop
∀ v, (holds v p ↔ holds v q)
def
omega.int.preform.equiv
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[ "equiv" ]
equiv p q := under any valuation, p holds iff q holds
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sat_of_implies_of_sat {p q : preform} : implies p q → sat p → sat q
begin intros h1 h2, apply exists_imp_exists h1 h2 end
lemma
omega.int.preform.sat_of_implies_of_sat
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sat_or {p q : preform} : sat (p ∨* q) ↔ sat p ∨ sat q
begin constructor; intro h1, { cases h1 with v h1, cases h1 with h1 h1; [left,right]; refine ⟨v,_⟩; assumption }, { cases h1 with h1 h1; cases h1 with v h1; refine ⟨v,_⟩; [left,right]; assumption } end
lemma
omega.int.preform.sat_or
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
unsat (p : preform) : Prop
¬ sat p
def
omega.int.preform.unsat
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
There does not exist any valuation that satisfies argument
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
repr : preform → string
| (t =* s) := "(" ++ t.repr ++ " = " ++ s.repr ++ ")" | (t ≤* s) := "(" ++ t.repr ++ " ≤ " ++ s.repr ++ ")" | (¬* p) := "¬" ++ p.repr | (p ∨* q) := "(" ++ p.repr ++ " ∨ " ++ q.repr ++ ")" | (p ∧* q) := "(" ++ p.repr ++ " ∧ " ++ q.repr ++ ")"
def
omega.int.preform.repr
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
has_repr : has_repr preform
⟨repr⟩
instance
omega.int.preform.has_repr
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
has_to_format : has_to_format preform
⟨λ x, x.repr⟩
instance
omega.int.preform.has_to_format
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
univ_close_of_valid {p : preform} : ∀ {m v}, p.valid → univ_close p v m
| 0 v h1 := h1 _ | (m+1) v h1 := λ i, univ_close_of_valid h1
lemma
omega.int.univ_close_of_valid
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
valid_of_unsat_not {p : preform} : (¬*p).unsat → p.valid
begin simp only [preform.sat, preform.unsat, preform.valid, preform.holds], rw not_exists_not, intro h, assumption end
lemma
omega.int.valid_of_unsat_not
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[ "not_exists_not" ]
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.int.preform.induce
tactic.omega.int
src/tactic/omega/int/form.lean
[ "tactic.omega.int.preterm" ]
[ "ih" ]
Tactic for setting up proof by induction over preforms.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
desugar
`[try {simp only with sugar}]
def
omega.int.desugar
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
univ_close_of_unsat_clausify (m : nat) (p : preform) : clauses.unsat (dnf (¬* p)) → univ_close p (λ x, 0) m | h1
begin apply univ_close_of_valid, apply valid_of_unsat_not, apply unsat_of_clauses_unsat, exact h1 end
lemma
omega.int.univ_close_of_unsat_clausify
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_univ_close (m : nat) (p : preform) : tactic expr
do x ← prove_unsats (dnf (¬*p)), return `(univ_close_of_unsat_clausify %%`(m) %%`(p) %%x)
def
omega.int.prove_univ_close
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
Given a (p : preform), return the expr of a (t : univ_close m p)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
to_exprterm : expr → tactic exprterm
| `(- %%x) := --return (exprterm.exp (-1 : int) x) ( do z ← eval_expr' int x, return (exprterm.cst (-z : int)) ) <|> ( return $ exprterm.exp (-1 : int) x ) | `(%%mx * %%zx) := do z ← eval_expr' int zx, return (exprterm.exp z mx) | `(%%t1x + %%t2x) := do t1 ← to_exprterm t1x, t2 ← to_exprterm t2...
def
omega.int.to_exprterm
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
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.int.to_exprform
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
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
def
omega.int.exprterm.exprs
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
List of all unreified exprs
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
exprform.exprs : exprform → list expr
| (exprform.eq t s) := list.union t.exprs s.exprs | (exprform.le t s) := list.union t.exprs s.exprs | (exprform.not p) := p.exprs | (exprform.or p q) := list.union p.exprs q.exprs | (exprform.and p q) := list.union p.exprs q.exprs
def
omega.int.exprform.exprs
tactic.omega.int
src/tactic/omega/int/main.lean
[ "tactic.omega.prove_unsats", "tactic.omega.int.dnf" ]
[]
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)
def
omega.int.exprterm.to_preterm
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