Get the i
th element of a vector
Equations
- vector3.nth i v = v i
Construct a vector from a function on fin2
.
Equations
- vector3.of_fn f = f
Equations
- vector3.nil_elim H v = _.mpr H
Equations
- v.rec_on H0 Hs = n.rec_on (λ (v : vector3 α 0), vector3.nil_elim H0 v) (λ (n : ℕ) (IH : Π (_a : vector3 α n), C _a) (v : vector3 α n.succ), vector3.cons_elim (λ (a : α) (t : vector3 α n), Hs a t (IH t)) v) v
Append two vectors
Insert a
into v
at index i
.
Equations
- vector3.insert a v i = λ (j : fin2 n.succ), (a :: v) (i.insert_perm j)
"Curried" forall, i.e. ∀ x1 ... xn, f [x1, ..., xn]
Equations
- vector_all k.succ f = ∀ (x : α), vector_all k (λ (v : vector3 α k), f (x :: v))
- vector_all 0 f = f vector3.nil
vector_allp p v
is equivalent to ∀ i, p (v i)
, but unfolds directly to a conjunction,
i.e. vector_allp p [0, 1, 2] = p 0 ∧ p 1 ∧ p 2
.
Equations
- decidable_list_all p l = decidable_of_decidable_of_iff (list.decidable_ball (λ (x : α), p x) l) _
- proj : ∀ {α : Sort u_1} (i : α), is_poly (λ (x : α → ℕ), ↑(x i))
- const : ∀ {α : Sort u_1} (n : ℤ), is_poly (λ (x : α → ℕ), n)
- sub : ∀ {α : Sort u_1} {f g : (α → ℕ) → ℤ}, is_poly f → is_poly g → is_poly (λ (x : α → ℕ), f x - g x)
- mul : ∀ {α : Sort u_1} {f g : (α → ℕ) → ℤ}, is_poly f → is_poly g → is_poly (λ (x : α → ℕ), f x * g x)
A predicate asserting that a function is a multivariate integer polynomial. (We are being a bit lazy here by allowing many representations for multiplication, rather than only allowing monomials and addition, but the definition is equivalent and this is easier to use.)
The constant function with value n : ℤ
.
Equations
- poly.const n = ⟨λ (x : α → ℕ), n, _⟩
Equations
- poly.has_zero = {zero := poly.zero α}
Equations
- poly.has_one = {one := poly.one α}
Equations
- poly.has_sub = {sub := poly.sub α}
Equations
- poly.has_neg = {neg := poly.neg α}
Equations
- poly.has_add = {add := poly.add α}
Equations
- poly.has_mul = {mul := poly.mul α}
Equations
- poly.comm_ring = {add := has_add.add poly.has_add, add_assoc := _, zero := 0, zero_add := _, add_zero := _, neg := has_neg.neg poly.has_neg, add_left_neg := _, add_comm := _, mul := has_mul.mul poly.has_mul, mul_assoc := _, one := 1, one_mul := _, mul_one := _, left_distrib := _, right_distrib := _, mul_comm := _}
The sum of squares of a list of polynomials. This is relevant for
Diophantine equations, because it means that a list of equations
can be encoded as a single equation: x = 0 ∧ y = 0 ∧ z = 0
is
equivalent to x^2 + y^2 + z^2 = 0
.
Equations
- poly.sumsq (p :: ps) = p * p + poly.sumsq ps
- poly.sumsq list.nil = 0
Map the index set of variables, replacing x_i
with x_(f i)
.
Functions from option
can be combined similarly to vector.cons
A partial function is Diophantine if its graph is Diophantine.
Equations
- dioph.dioph_pfun f = dioph (λ (v : option α → ℕ), f.graph (v ∘ option.some, v option.none))
A function is Diophantine if its graph is Diophantine.
Equations
- dioph.dioph_fn f = dioph (λ (v : option α → ℕ), f (v ∘ option.some) = v option.none)