-- Mathlib/NumberTheory/Dioph.lean
theorem pow_dioph {f g : (α → ℕ) → ℕ} (df : DiophFn f) (dg : DiophFn g) :
    DiophFn fun v => f v ^ g v

Proof state:
α : Type
f g : (α → ℕ) → ℕ
df : DiophFn f
dg : DiophFn g
proof :
  Dioph
    (((fun v => v &2 = const (Fin2 3 → ℕ) 0 v) ∩ fun v => v &0 = const (Fin2 3 → ℕ) 1 v) ∪
      {v | const (Fin2 3 → ℕ) 0 v < v &2} ∩
        (((fun v => v &1 = const (Fin2 3 → ℕ) 0 v) ∩ fun v => v &0 = const (Fin2 3 → ℕ) 0 v) ∪
          {v | const (Fin2 3 → ℕ) 0 v < v &1} ∩
            {v |
              ∃ x,
                (x :: v) ∈
                  {v |
                    ∃ x,
                      (x :: v) ∈
                        {v |
                          ∃ x,
                            (x :: v) ∈
                              {v |
                                ∃ x,
                                  (x :: v) ∈
                                    {v |
                                      ∃ x,
                                        (x :: v) ∈
                                          {v |
                                            ∃ x,
                                              (x :: v) ∈
                                                {v |
                                                    (v ∘ &4 :: &8 :: &1 :: &0 :: []) ∈ fun v =>
                                                      ∃ (h : 1 < v &0), xn h (v &1) = v &2 ∧ yn h (v &1) = v &3} ∩
                                                  ((fun v => v &1 ≡ v &0 * (v &4 - v &7) + v &6 [MOD v &3]) ∩
                                                    ((fun v =>
                                                        const (Fin2 (succ 8) → ℕ) 2 v * v &4 * v &7 =
                                                          v &3 + (v &7 * v &7 + const (Fin2 (succ 8) → ℕ) 1 v)) ∩
                                                      ({v | v &6 < v &3} ∩
                                                        ({v | v &7 ≤ v &5} ∩
                                                          ({v | v &8 ≤ v &5} ∩ fun v =>
                                                            v &4 * v &4 -
                                                                ((v &5 + const (Fin2 (succ 8) → ℕ) 1 v) *
                                                                        (v &5 + const (Fin2 (succ 8) → ℕ) 1 v) -
                                                                      const (Fin2 (succ 8) → ℕ) 1 v) *
                                                                    (v &5 * v &2) *
                                                                  (v &5 * v &2) =
                                                              const (Fin2 (succ 8) → ℕ) 1 v)))))}}}}}}))
⊢ Dioph
    {v |
      v &2 = 0 ∧ v &0 = 1 ∨
        0 < v &2 ∧
          (v &1 = 0 ∧ v &0 = 0 ∨
            0 < v &1 ∧
              ∃ w a t z x y,
                (∃ (a1 : 1 < a), xn a1 (v &2) = x ∧ yn a1 (v &2) = y) ∧
                  x ≡ y * (a - v &1) + v &0 [MOD t] ∧
                    2 * a * v &1 = t + (v &1 * v &1 + 1) ∧
                      v &0 < t ∧ v &1 ≤ w ∧ v &2 ≤ w ∧ a * a - ((w + 1) * (w + 1) - 1) * (w * z) * (w * z) = 1)}

Tactic:
exact proof

Result:
no goals

Proof state:
α : Type
f g : (α → ℕ) → ℕ
df : DiophFn f
dg : DiophFn g
⊢ DiophFn fun v => f v ^ g v

Tactic:
have proof :=
  let D_pell := pell_dioph.reindex_dioph (Fin2 9) [&4, &8, &1, &0]
  (D&2 D= D.0 D∧ D&0 D= D.1) D∨ (D.0 D< D&2 D∧
  ((D&1 D= D.0 D∧ D&0 D= D.0) D∨ (D.0 D< D&1 D∧
  ((D∃) 3 <| (D∃) 4 <| (D∃) 5 <| (D∃) 6 <| (D∃) 7 <| (D∃) 8 <| D_pell D∧
  (D≡ (D&1) (D&0 D* (D&4 D- D&7) D+ D&6) (D&3)) D∧
  D.2 D* D&4 D* D&7 D= D&3 D+ (D&7 D* D&7 D+ D.1) D∧
  D&6 D< D&3 D∧ D&7 D≤ D&5 D∧ D&8 D≤ D&5 D∧
  D&4 D* D&4 D- ((D&5 D+ D.1) D* (D&5 D+ D.1) D- D.1) D* (D&5 D* D&2) D* (D&5 D* D&2) D= D.1))))

Result:
α : Type
f g : (α → ℕ) → ℕ
df : DiophFn f
dg : DiophFn g
proof :
  Dioph
    (((fun v => v &2 = const (Fin2 3 → ℕ) 0 v) ∩ fun v => v &0 = const (Fin2 3 → ℕ) 1 v) ∪
      {v | const (Fin2 3 → ℕ) 0 v < v &2} ∩
        (((fun v => v &1 = const (Fin2 3 → ℕ) 0 v) ∩ fun v => v &0 = const (Fin2 3 → ℕ) 0 v) ∪
          {v | const (Fin2 3 → ℕ) 0 v < v &1} ∩
            {v |
              ∃ x,
                (x :: v) ∈
                  {v |
                    ∃ x,
                      (x :: v) ∈
                        {v |
                          ∃ x,
                            (x :: v) ∈
                              {v |
                                ∃ x,
                                  (x :: v) ∈
                                    {v |
                                      ∃ x,
                                        (x :: v) ∈
                                          {v |
                                            ∃ x,
                                              (x :: v) ∈
                                                {v |
                                                    (v ∘ &4 :: &8 :: &1 :: &0 :: []) ∈ fun v =>
                                                      ∃ (h : 1 < v &0), xn h (v &1) = v &2 ∧ yn h (v &1) = v &3} ∩
                                                  ((fun v => v &1 ≡ v &0 * (v &4 - v &7) + v &6 [MOD v &3]) ∩
                                                    ((fun v =>
                                                        const (Fin2 (succ 8) → ℕ) 2 v * v &4 * v &7 =
                                                          v &3 + (v &7 * v &7 + const (Fin2 (succ 8) → ℕ) 1 v)) ∩
                                                      ({v | v &6 < v &3} ∩
                                                        ({v | v &7 ≤ v &5} ∩
                                                          ({v | v &8 ≤ v &5} ∩ fun v =>
                                                            v &4 * v &4 -
                                                                ((v &5 + const (Fin2 (succ 8) → ℕ) 1 v) *
                                                                        (v &5 + const (Fin2 (succ 8) → ℕ) 1 v) -
                                                                      const (Fin2 (succ 8) → ℕ) 1 v) *
                                                                    (v &5 * v &2) *
                                                                  (v &5 * v &2) =
                                                              const (Fin2 (succ 8) → ℕ) 1 v)))))}}}}}}))
⊢ DiophFn fun v => f v ^ g v