Documentation

AMMLib.FeeVersion.Arbitrage

def SX.fee.arbitrage.is_solution_less {sx : SX} {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw : Swap sx s a t0 t1 x₀) (o : O) :
Equations
  • One or more equations did not get rendered due to their size.
Instances For
    def SX.fee.arbitrage.is_solution_more (φ : ℝ>0) {sx : SX} {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw : Swap sx s a t0 t1 x₀) (o : O) :
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def SX.fee.arbitrage.is_solution (φ : ℝ>0) {sx : SX} {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw : Swap sx s a t0 t1 x₀) (o : O) :
      Equations
      Instances For
        theorem SX.fee.arbitrage.constprod.solution_less (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (o : O) (hφ : φ < 1) (h_equil : constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = o t0 / o t1) :
        theorem SX.fee.arbitrage.αx₀_add_βx₁_simp (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x₁ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (sw1 : Swap (constprod φ) sw0.apply a t0 t1 x₁) :
        ↑x₀ * ↑sw0.rate + ↑x₁ * ↑sw1.rate = ↑φ * ↑(s.amms.r1 t0 t1 ⋯) * (↑x₀ ^ 2 + ↑(s.amms.r0 t0 t1 ⋯) * ↑x₀ + ↑φ * ↑x₀ * ↑x₁ + ↑(s.amms.r0 t0 t1 ⋯) * ↑x₁) / ((↑(s.amms.r0 t0 t1 ⋯) + ↑x₀ + ↑φ * ↑x₁) * (↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀))
        theorem SX.fee.arbitrage.z_sub_one_simp (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x₁ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) :
        Swap (constprod φ) sw0.apply a t0 t1 x₁ → ↑(z φ x₀ x₁ (s.amms.r0 t0 t1 ⋯)) - ↑1 = -(↑(s.amms.r0 t0 t1 ⋯) * ↑x₀ * ↑x₁ * (↑φ - ↑1) / ((↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀ + ↑φ * ↑x₁) * (↑x₀ ^ 2 + ↑(s.amms.r0 t0 t1 ⋯) * ↑x₀ + ↑φ * ↑x₀ * ↑x₁ + ↑(s.amms.r0 t0 t1 ⋯) * ↑x₁)))
        theorem SX.fee.arbitrage.z_sub_one_α_β_simp (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x₁ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (sw1 : Swap (constprod φ) sw0.apply a t0 t1 x₁) :
        (↑(z φ x₀ x₁ (s.amms.r0 t0 t1 ⋯)) - ↑1) * (↑x₀ * ↑sw0.rate + ↑x₁ * ↑sw1.rate) = -(↑φ * ↑(s.amms.r0 t0 t1 ⋯) * ↑(s.amms.r1 t0 t1 ⋯) * ↑x₀ * ↑x₁ * (↑φ - 1) / ((↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀ + ↑φ * ↑x₁) * (↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀) * (↑(s.amms.r0 t0 t1 ⋯) + ↑x₀ + ↑φ * ↑x₁)))
        theorem SX.fee.arbitrage.big_factor_simp' (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x₁ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (sw1 : Swap (constprod φ) sw0.apply a t0 t1 x₁) :
        ↑x₁ * ↑sw1.rate + (↑(z φ x₀ x₁ (s.amms.r0 t0 t1 ⋯)) - ↑1) * (↑x₀ * ↑sw0.rate + ↑x₁ * ↑sw1.rate) = ↑φ * ↑(s.amms.r0 t0 t1 ⋯) * ↑(s.amms.r1 t0 t1 ⋯) * ↑x₁ / ((↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀ + ↑φ * ↑x₁) * (↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀))
        theorem SX.fee.arbitrage.big_factor_simp (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x₁ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (sw1 : Swap (constprod φ) sw0.apply a t0 t1 x₁) :
        (↑x₁ * ↑sw1.rate + (↑(z φ x₀ x₁ (s.amms.r0 t0 t1 ⋯)) - ↑1) * (↑x₀ * ↑sw0.rate + ↑x₁ * ↑sw1.rate)) / ↑x₁ = ↑φ * ↑(s.amms.r0 t0 t1 ⋯) * ↑(s.amms.r1 t0 t1 ⋯) / ((↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀ + ↑φ * ↑x₁) * (↑(s.amms.r0 t0 t1 ⋯) + ↑φ * ↑x₀))
        theorem SX.fee.arbitrage.int_rate_simp (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) :
        constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = φ * s.amms.r0 t0 t1 ⋯ * s.amms.r1 t0 t1 ⋯ / ((s.amms.r0 t0 t1 ⋯ + x₀) * (s.amms.r0 t0 t1 ⋯ + φ * x₀))
        theorem SX.fee.arbitrage.add_gain_εφ_neg (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x x₁ : ℝ>0} {hφ : φ < 1} {h_supply : s.mints.supply t0 t1 > 0} {h_mints : (s.mints.get a).get t0 t1 < s.mints.supply t0 t1} (sw0 : Swap (constprod φ) s a t0 t1 x₀) :
        Swap (constprod φ) s a t0 t1 x → ∀ (sw2 : Swap (constprod φ) sw0.apply a t0 t1 x₁) (h_split : x = x₀ + x₁) (o : O) (h_equil : constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = o t0 / o t1), a.gain o sw0.apply sw2.apply + ↑(εφ φ sw0 sw2 hφ o h_supply h_mints) < 0 ↔ x > x₀ / φ
        theorem SX.fee.arbitrage.add_gain_εφ_pos (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ x x₁ : ℝ>0} {hφ : φ < 1} {h_supply : s.mints.supply t0 t1 > 0} {h_mints : (s.mints.get a).get t0 t1 < s.mints.supply t0 t1} (sw0 : Swap (constprod φ) s a t0 t1 x₀) :
        Swap (constprod φ) s a t0 t1 x → ∀ (sw2 : Swap (constprod φ) sw0.apply a t0 t1 x₁) (h_split : x = x₀ + x₁) (o : O) (h_equil : constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = o t0 / o t1), a.gain o sw0.apply sw2.apply + ↑(εφ φ sw0 sw2 hφ o h_supply h_mints) > 0 ↔ x < x₀ / φ
        theorem SX.fee.arbitrage.constprod.solution_more (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (o : O) (hφ : φ < 1) (h_equil : constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = o t0 / o t1) :
        theorem SX.fee.arbitrage.constprod.equil_value (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (o : O) (hφ : φ < 1) (h_pos : (o t0).sqrt * s.amms.r0 t0 t1 ⋯ * (1 + φ) < (s.amms.r0 t0 t1 ⋯).sqrt * (o t0 * s.amms.r0 t0 t1 ⋯ * ⟨(↑φ - 1) ^ 2, ⋯⟩ + ⟨4, ⋯⟩ * o t1 * s.amms.r1 t0 t1 ⋯ * φ ^ 2).sqrt) (h0 : x₀ = ((s.amms.r0 t0 t1 ⋯).sqrt * (o t0 * s.amms.r0 t0 t1 ⋯ * ⟨(↑φ - 1) ^ 2, ⋯⟩ + ⟨4, ⋯⟩ * o t1 * s.amms.r1 t0 t1 ⋯ * φ ^ 2).sqrt).sub ((o t0).sqrt * s.amms.r0 t0 t1 ⋯ * (1 + φ)) h_pos / (⟨2, ⋯⟩ * (o t0).sqrt * φ)) :
        constprod.int_rate φ (sw0.apply.amms.r0 t0 t1 ⋯) (sw0.apply.amms.r1 t0 t1 ⋯) = o t0 / o t1
        theorem SX.fee.arbitrage.constprod.equil_value_solution_arbitrage (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (o : O) (hφ : φ < 1) (h_pos : (o t0).sqrt * s.amms.r0 t0 t1 ⋯ * (1 + φ) < (s.amms.r0 t0 t1 ⋯).sqrt * (o t0 * s.amms.r0 t0 t1 ⋯ * ⟨(↑φ - 1) ^ 2, ⋯⟩ + ⟨4, ⋯⟩ * o t1 * s.amms.r1 t0 t1 ⋯ * φ ^ 2).sqrt) (h0 : x₀ = ((s.amms.r0 t0 t1 ⋯).sqrt * (o t0 * s.amms.r0 t0 t1 ⋯ * ⟨(↑φ - 1) ^ 2, ⋯⟩ + ⟨4, ⋯⟩ * o t1 * s.amms.r1 t0 t1 ⋯ * φ ^ 2).sqrt).sub ((o t0).sqrt * s.amms.r0 t0 t1 ⋯ * (1 + φ)) h_pos / (⟨2, ⋯⟩ * (o t0).sqrt * φ)) :
        is_solution φ sw0 o
        theorem SX.fee.arbitrage.constprod.solution_equil_unique (φ : ℝ>0) {s : Γ} {a : A} {t0 t1 : T} {x₀ : ℝ>0} (sw0 : Swap (constprod φ) s a t0 t1 x₀) (o : O) (h_equil : constprod.sw_to_equil φ sw0 o) :
        ¬∃ (x₁ : ℝ>0) (h_enough : ↑x₁ ≤ (s.atoms.get a) t0), x₁ ≠ x₀ ∧ constprod.sw_to_equil φ ⋯ o