Documentation

Init.Grind.Ordered.Linarith

Support for the linear arithmetic module for IntModule in grind

@[reducible, inline]
Equations
Instances For
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[reducible, inline]
        Equations
        Instances For
          @[reducible, inline]
          abbrev Lean.Grind.Linarith.Var.denote {α : Type u_1} (ctx : Context α) (v : Var) :
          α
          Equations
          Instances For
            @[inline]
            noncomputable abbrev Lean.Grind.Linarith.Expr.denote_k {α : Type u_1} [IntModule α] (ctx : Context α) (e : Expr) :
            α

            Expr.denote for kernel reduction. The theorems that take hypotheses about user terms state them with Expr.denote_k, so that the kernel unfolds Expr.rec instead of Expr.denote's brecOn. It is an abbrev so that the kernel's lazy delta reduction unfolds it before the user's terms.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[simp]
              theorem Lean.Grind.Linarith.Expr.denote_k_eq_denote {α : Type u_1} [IntModule α] (ctx : Context α) (e : Expr) :
              denote_k ctx e = denote ctx e
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Lean.Grind.Linarith.instAssociativeHAdd {α : Type u_1} [IntModule α] :
                  Std.Associative fun (x1 x2 : α) => x1 + x2
                  theorem Lean.Grind.Linarith.instCommutativeHAdd {α : Type u_1} [IntModule α] :
                  Std.Commutative fun (x1 x2 : α) => x1 + x2
                  theorem Lean.Grind.Linarith.Poly.denote'_eq_denote {α : Type u_1} [IntModule α] (ctx : Context α) (p : Poly) :
                  denote' ctx p = denote ctx p
                  Equations
                  Instances For
                    Equations
                    Instances For

                      Normalizes the given polynomial by fusing monomial and constants.

                      Equations
                      Instances For
                        @[irreducible]
                        Equations
                        Instances For

                          Converts the given expression into a polynomial.

                          Equations
                          Instances For

                            Converts the given expression into a polynomial, and then normalizes it.

                            Equations
                            Instances For

                              p.mul k multiplies all coefficients and constant of the polynomial p by k.

                              Equations
                              Instances For
                                @[simp]
                                theorem Lean.Grind.Linarith.Poly.denote_mul {α : Type u_1} [IntModule α] (ctx : Context α) (p : Poly) (k : Int) :
                                denote ctx (p.mul k) = k • denote ctx p
                                theorem Lean.Grind.Linarith.Poly.denote_insert {α : Type u_1} [IntModule α] (ctx : Context α) (k : Int) (v : Var) (p : Poly) :
                                denote ctx (insert k v p) = denote ctx p + k • Var.denote ctx v
                                theorem Lean.Grind.Linarith.Poly.denote_norm {α : Type u_1} [IntModule α] (ctx : Context α) (p : Poly) :
                                denote ctx p.norm = denote ctx p
                                theorem Lean.Grind.Linarith.Poly.denote_append {α : Type u_1} [IntModule α] (ctx : Context α) (p₁ p₂ : Poly) :
                                denote ctx (p₁.append p₂) = denote ctx p₁ + denote ctx p₂
                                theorem Lean.Grind.Linarith.Poly.denote_combine {α : Type u_1} [IntModule α] (ctx : Context α) (p₁ p₂ : Poly) :
                                denote ctx (p₁.combine p₂) = denote ctx p₁ + denote ctx p₂
                                theorem Lean.Grind.Linarith.Expr.denote_norm {α : Type u_1} [IntModule α] (ctx : Context α) (e : Expr) :
                                Poly.denote ctx e.norm = denote ctx e

                                Kernel-reduction variants of the polynomial functions used by the certificates, written with recursors, Bool.rec, and the operations of Init.Data.Int.Kernel.

                                noncomputable def Lean.Grind.Linarith.Poly.beq' (p₁ : Poly) :
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[simp]
                                  theorem Lean.Grind.Linarith.Poly.beq'_eq (p₁ p₂ : Poly) :
                                  (p₁.beq' p₂ = true) = (p₁ = p₂)
                                  noncomputable def Lean.Grind.Linarith.Poly.mul_k (p : Poly) (k : Int) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[simp]
                                    theorem Lean.Grind.Linarith.Poly.mul_k_eq (p : Poly) (k : Int) :
                                    p.mul_k k = p.mul k
                                    noncomputable def Lean.Grind.Linarith.Poly.combine_k (p₁ : Poly) :
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem Lean.Grind.Linarith.Poly.combine_k_add_add (a₁ : Int) (x₁ : Var) (p₁ : Poly) (a₂ : Int) (x₂ : Var) (p₂ : Poly) :
                                      (add a₁ x₁ p₁).combine_k (add a₂ x₂ p₂) = Bool.rec (Bool.rec (add a₂ x₂ ((add a₁ x₁ p₁).combine_k p₂)) (add a₁ x₁ (p₁.combine_k (add a₂ x₂ p₂))) (Nat.blt x₂ x₁)) (Bool.rec (add (a₁.add_k a₂) x₁ (p₁.combine_k p₂)) (p₁.combine_k p₂) (a₁.add_k a₂).beqZero_k) (Nat.beq x₁ x₂)
                                      @[simp]
                                      theorem Lean.Grind.Linarith.Poly.denote_combine_k {α : Type u_1} [IntModule α] (ctx : Context α) (p₁ p₂ : Poly) :
                                      denote ctx (p₁.combine_k p₂) = denote ctx p₁ + denote ctx p₂
                                      noncomputable def Lean.Grind.Linarith.Poly.coeff_k (p : Poly) (x : Var) :
                                      Equations
                                      Instances For
                                        @[simp]
                                        noncomputable def Lean.Grind.Linarith.Poly.insert_k (k : Int) (v : Var) (p : Poly) :
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          @[simp]
                                          theorem Lean.Grind.Linarith.Poly.insert_k_eq (k : Int) (v : Var) (p : Poly) :
                                          insert_k k v p = insert k v p
                                          noncomputable def Lean.Grind.Linarith.Poly.norm_k (p : Poly) :
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem Lean.Grind.Linarith.Expr.toPoly'_k_go (e : Expr) (c : Int) (p : Poly) :
                                              rec (motive := fun (x : Expr) => Int → Poly → Poly) (fun (x : Int) (p : Poly) => p) (fun (v : Var) (c : Int) (p : Poly) => Poly.add c v p) (fun (x x_1 : Expr) (iha ihb : Int → Poly → Poly) (c : Int) (p : Poly) => iha c (ihb c p)) (fun (x x_1 : Expr) (iha ihb : Int → Poly → Poly) (c : Int) (p : Poly) => iha c (ihb c.neg_k p)) (fun (x : Expr) (iha : Int → Poly → Poly) (c : Int) (p : Poly) => iha c.neg_k p) (fun (k : Nat) (x : Expr) (iha : Int → Poly → Poly) (c : Int) (p : Poly) => Bool.rec (iha (c.mul_k (Int.ofNat k)) p) p (k.beq 0)) (fun (k : Int) (x : Expr) (iha : Int → Poly → Poly) (c : Int) (p : Poly) => Bool.rec (iha (c.mul_k k) p) p k.beqZero_k) e c p = toPoly'.go c e p
                                              noncomputable def Lean.Grind.Linarith.Expr.norm_k (e : Expr) :
                                              Equations
                                              Instances For

                                                Helper theorems for conflict resolution during model construction.

                                                noncomputable def Lean.Grind.Linarith.le_le_combine_cert (p₁ p₂ p₃ : Poly) :
                                                Equations
                                                Instances For
                                                  theorem Lean.Grind.Linarith.le_le_combine {α : Type u_1} [IntModule α] [LE α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (p₁ p₂ p₃ : Poly) :
                                                  le_le_combine_cert p₁ p₂ p₃ = true → Poly.denote' ctx p₁ ≤ 0 → Poly.denote' ctx p₂ ≤ 0 → Poly.denote' ctx p₃ ≤ 0
                                                  noncomputable def Lean.Grind.Linarith.le_lt_combine_cert (p₁ p₂ p₃ : Poly) :
                                                  Equations
                                                  Instances For
                                                    theorem Lean.Grind.Linarith.le_lt_combine {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (p₁ p₂ p₃ : Poly) :
                                                    le_lt_combine_cert p₁ p₂ p₃ = true → Poly.denote' ctx p₁ ≤ 0 → Poly.denote' ctx p₂ < 0 → Poly.denote' ctx p₃ < 0
                                                    noncomputable def Lean.Grind.Linarith.lt_lt_combine_cert (p₁ p₂ p₃ : Poly) :
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      theorem Lean.Grind.Linarith.lt_lt_combine {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (p₁ p₂ p₃ : Poly) :
                                                      lt_lt_combine_cert p₁ p₂ p₃ = true → Poly.denote' ctx p₁ < 0 → Poly.denote' ctx p₂ < 0 → Poly.denote' ctx p₃ < 0
                                                      noncomputable def Lean.Grind.Linarith.diseq_split_cert (p₁ p₂ : Poly) :
                                                      Equations
                                                      Instances For
                                                        theorem Lean.Grind.Linarith.diseq_split {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearOrder α] [OrderedAdd α] (ctx : Context α) (p₁ p₂ : Poly) :
                                                        diseq_split_cert p₁ p₂ = true → Poly.denote' ctx p₁ ≠ 0 → Poly.denote' ctx p₁ < 0 ∨ Poly.denote' ctx p₂ < 0
                                                        theorem Lean.Grind.Linarith.diseq_split_resolve {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearOrder α] [OrderedAdd α] (ctx : Context α) (p₁ p₂ : Poly) :
                                                        diseq_split_cert p₁ p₂ = true → Poly.denote' ctx p₁ ≠ 0 → ¬Poly.denote' ctx p₁ < 0 → Poly.denote' ctx p₂ < 0

                                                        Helper theorems for internalizing facts into the linear arithmetic procedure

                                                        noncomputable def Lean.Grind.Linarith.norm_cert (lhs rhs : Expr) (p : Poly) :
                                                        Equations
                                                        Instances For
                                                          theorem Lean.Grind.Linarith.eq_norm {α : Type u_1} [IntModule α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert lhs rhs p = true → Expr.denote_k ctx lhs = Expr.denote_k ctx rhs → Poly.denote' ctx p = 0
                                                          theorem Lean.Grind.Linarith.le_of_eq {α : Type u_1} [IntModule α] [LE α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert lhs rhs p = true → Expr.denote_k ctx lhs = Expr.denote_k ctx rhs → Poly.denote' ctx p ≤ 0
                                                          theorem Lean.Grind.Linarith.diseq_norm {α : Type u_1} [IntModule α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert lhs rhs p = true → Expr.denote_k ctx lhs ≠ Expr.denote_k ctx rhs → Poly.denote' ctx p ≠ 0
                                                          theorem Lean.Grind.Linarith.le_norm {α : Type u_1} [IntModule α] [LE α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert lhs rhs p = true → Expr.denote_k ctx lhs ≤ Expr.denote_k ctx rhs → Poly.denote' ctx p ≤ 0
                                                          theorem Lean.Grind.Linarith.lt_norm {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] [OrderedAdd α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert lhs rhs p = true → Expr.denote_k ctx lhs < Expr.denote_k ctx rhs → Poly.denote' ctx p < 0
                                                          theorem Lean.Grind.Linarith.not_le_norm {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearOrder α] [OrderedAdd α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert rhs lhs p = true → ¬Expr.denote_k ctx lhs ≤ Expr.denote_k ctx rhs → Poly.denote' ctx p < 0
                                                          theorem Lean.Grind.Linarith.not_lt_norm {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearOrder α] [OrderedAdd α] (ctx : Context α) (lhs rhs : Expr) (p : Poly) :
                                                          norm_cert rhs lhs p = true → ¬Expr.denote_k ctx lhs < Expr.denote_k ctx rhs → Poly.denote' ctx p ≤ 0

                                                          Helper theorems for closing the goal

                                                          theorem Lean.Grind.Linarith.lt_unsat {α : Type u_1} [IntModule α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (ctx : Context α) :
                                                          theorem Lean.Grind.Linarith.zero_lt_one {α : Type u_1} [Ring α] [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] [OrderedRing α] (ctx : Context α) (p : Poly) :

                                                          Coefficient normalization

                                                          noncomputable def Lean.Grind.Linarith.eq_neg_cert (p₁ p₂ : Poly) :
                                                          Equations
                                                          Instances For
                                                            theorem Lean.Grind.Linarith.eq_neg {α : Type u_1} [IntModule α] (ctx : Context α) (p₁ p₂ : Poly) :
                                                            eq_neg_cert p₁ p₂ = true → Poly.denote' ctx p₁ = 0 → Poly.denote' ctx p₂ = 0
                                                            noncomputable def Lean.Grind.Linarith.eq_coeff_cert (p₁ p₂ : Poly) (k : Nat) :
                                                            Equations
                                                            Instances For
                                                              theorem Lean.Grind.Linarith.eq_coeff {α : Type u_1} [IntModule α] [NoNatZeroDivisors α] (ctx : Context α) (p₁ p₂ : Poly) (k : Nat) :
                                                              eq_coeff_cert p₁ p₂ k = true → Poly.denote' ctx p₁ = 0 → Poly.denote' ctx p₂ = 0
                                                              theorem Lean.Grind.Linarith.diseq_neg {α : Type u_1} [IntModule α] (ctx : Context α) (p p' : Poly) :
                                                              p'.beq' (p.mul_k (-1)) = true → Poly.denote' ctx p ≠ 0 → Poly.denote' ctx p' ≠ 0

                                                              Substitution

                                                              noncomputable def Lean.Grind.Linarith.eq_diseq_subst_cert (k₁ k₂ : Int) (p₁ p₂ p₃ : Poly) :
                                                              Equations
                                                              Instances For
                                                                theorem Lean.Grind.Linarith.eq_diseq_subst {α : Type u_1} [IntModule α] [NoNatZeroDivisors α] (ctx : Context α) (k₁ k₂ : Int) (p₁ p₂ p₃ : Poly) :
                                                                eq_diseq_subst_cert k₁ k₂ p₁ p₂ p₃ = true → Poly.denote' ctx p₁ = 0 → Poly.denote' ctx p₂ ≠ 0 → Poly.denote' ctx p₃ ≠ 0
                                                                noncomputable def Lean.Grind.Linarith.eq_diseq_subst1_cert (k : Int) (p₁ p₂ p₃ : Poly) :
                                                                Equations
                                                                Instances For
                                                                  theorem Lean.Grind.Linarith.eq_diseq_subst1 {α : Type u_1} [IntModule α] (ctx : Context α) (k : Int) (p₁ p₂ p₃ : Poly) :
                                                                  eq_diseq_subst1_cert k p₁ p₂ p₃ = true → Poly.denote' ctx p₁ = 0 → Poly.denote' ctx p₂ ≠ 0 → Poly.denote' ctx p₃ ≠ 0
                                                                  noncomputable def Lean.Grind.Linarith.eq_eq_subst_cert (x : Var) (p₁ p₂ p₃ : Poly) :
                                                                  Equations
                                                                  Instances For
                                                                    theorem Lean.Grind.Linarith.eq_eq_subst {α : Type u_1} [IntModule α] (ctx : Context α) (x : Var) (p₁ p₂ p₃ : Poly) :
                                                                    eq_eq_subst_cert x p₁ p₂ p₃ = true → Poly.denote' ctx p₁ = 0 → Poly.denote' ctx p₂ = 0 → Poly.denote' ctx p₃ = 0
                                                                    theorem Lean.Grind.Linarith.imp_eq {α : Type u_1} [IntModule α] (ctx : Context α) (p : Poly) (x y : Var) :
                                                                    imp_eq_cert p x y = true → Poly.denote' ctx p = 0 → Var.denote ctx x = Var.denote ctx y