## Linear Diaphontine Equations #

We solve linear diaphontine equations of the form `a * x + b * y = c`

where `a`

, `b`

, `c`

are integers if they have a solution with proof. Otherwise, we return a proof that there is no solution.

Solution of the linear diaphontine equation `a * x + b * y = c`

where `a`

, `b`

, `c`

are integers or a proof that there is no solution.

- solution: {a b c : ℤ} → (x y : ℤ) → a * x + b * y = c → DiaphontineSolution a b c
- unsolvable: {a b c : ℤ} → (∀ (x y : ℤ), ¬a * x + b * y = c) → DiaphontineSolution a b c

## Instances For

This has a solution if and only if the gcd of `a`

and `b`

divides `c`

.

- If the gcd of
`a`

and`b`

divides`c`

, by Bezout's Lemma there are integers`x`

and`y`

such that`a * x + b * y = gcd a b`

. Further, as`gcd a b`

divides`c`

, we have an integer`d`

such that`(gcd a b) * d = c`

. Then`x * d`

and`y * d`

are integers such that`a * (x * d) + b * (y * d) = c`

. - The converse follows as
`gcd a b`

divides`a`

and`b`

, hence`c = a * x + b * y`

.

The main results we need are in the library. Here are most of them:

```
#check Int.gcd_dvd_left -- ∀ (i j : ℤ), ↑(Int.gcd i j) ∣ i
#check Int.emod_add_ediv -- ∀ (a b : ℤ), a % b + b * (a / b) = a
#check Int.emod_eq_zero_of_dvd -- ∀ {a b : ℤ}, a ∣ b → b % a = 0
#check Int.dvd_mul_right -- ∀ (a b : ℤ), a ∣ a * b
#check Int.gcd_eq_gcd_ab -- ∀ (x y : ℤ), ↑(Int.gcd x y) = x * Int.gcdA x y + y * Int.gcdB x y
#check dvd_add /-∀ {α : Type u_1} [inst : Add α] [inst_1 : Semigroup α] [inst_2 : LeftDistribClass α] {a b c : α},
a ∣ b → a ∣ c → a ∣ b + c-/
```

Solution or proof there is no solution for `a * x + b * y = c`

## Equations

- One or more equations did not get rendered due to their size.