MindFormal v1.0.0One Mind

MindFormal.Tools.A617Market.AuctionBook

Instances For
    def MindFormal.A617Market.Auction.instDecidableEqMessage.decEq {K✝ : Type u_1} [DecidableEq K✝] (x✝ x✝¹ : Message K✝) :
    Decidable (x✝ = x✝¹)
    Equations
    Instances For
      structure MindFormal.A617Market.Auction.Order (A : Type u_1) (K : Type u_2) :
      Type (max u_1 u_2)
      • owner : A
      • price : K
      • buy : Bool
      • arrival : ℕ
      Instances For
        def MindFormal.A617Market.Auction.instDecidableEqOrder.decEq {A✝ : Type u_1} {K✝ : Type u_2} [DecidableEq A✝] [DecidableEq K✝] (x✝ x✝¹ : Order A✝ K✝) :
        Decidable (x✝ = x✝¹)
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          structure MindFormal.A617Market.Auction.Fill (A : Type u_1) (K : Type u_2) :
          Type (max u_1 u_2)
          • seller : A
          • buyer : A
          • paid : K
          Instances For
            def MindFormal.A617Market.Auction.instDecidableEqFill.decEq {A✝ : Type u_1} {K✝ : Type u_2} [DecidableEq A✝] [DecidableEq K✝] (x✝ x✝¹ : Fill A✝ K✝) :
            Decidable (x✝ = x✝¹)
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              structure MindFormal.A617Market.Auction.Book (A : Type u_1) (K : Type u_2) :
              Type (max u_1 u_2)

              Cash and units here are FREE assets. Outstanding bids escrow their whole limit price, asks escrow one unit. Arrival is a public message counter.

              Instances For
                def MindFormal.A617Market.Auction.executable {A : Type u_1} {K : Type u_2} (price : K → ℝ) (incoming resting : Order A K) :
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def MindFormal.A617Market.Auction.preferred {A : Type u_1} {K : Type u_2} (price : K → ℝ) (incoming x y : Order A K) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def MindFormal.A617Market.Auction.best {A : Type u_1} {K : Type u_2} (price : K → ℝ) (incoming : Order A K) :
                    List (Order A K) → Option (Order A K)

                    Lowest executable ask / highest executable bid, with arrival priority. The resting order is an earlier assent: no contemporary second V is read.

                    Equations
                    Instances For
                      theorem MindFormal.A617Market.Auction.best_member {A : Type u_1} {K : Type u_2} (price : K → ℝ) {incoming : Order A K} {os : List (Order A K)} {o : Order A K} (h : best price incoming os = some o) :
                      o ∈ os ∧ executable price incoming o
                      noncomputable def MindFormal.A617Market.Auction.reserve {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (o : Order A K) :
                      Option (Book A K)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        noncomputable def MindFormal.A617Market.Auction.cancel {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (a : A) (id : ℕ) :
                        Book A K
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          noncomputable def MindFormal.A617Market.Auction.matchOrder {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (incoming : Order A K) :
                          Book A K × Option (Fill A K)
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            noncomputable def MindFormal.A617Market.Auction.step {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (a : A) (m : Message K) :
                            Book A K × Option (Fill A K)
                            Equations
                            Instances For
                              def MindFormal.A617Market.Auction.run {A : Type u_1} {K : Type u_2} (price : K → ℝ) :
                              Book A K → List (A × Message K) → Book A K × List (Option (Fill A K))
                              Equations
                              Instances For
                                theorem MindFormal.A617Market.Auction.queue_induction {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (q q' : List (A × Message K)) (hq : q = q') :
                                run price B q = run price B q'

                                This induction propagates labels AND their global queue order to every reservation, cancellation, resting-price fill and returned book.

                                theorem MindFormal.A617Market.Auction.one_mark_per_message {A : Type u_1} {K : Type u_2} (price : K → ℝ) (B : Book A K) (q : List (A × Message K)) :
                                (run price B q).2.length = q.length
                                theorem MindFormal.A617Market.Auction.bid_reservation_nonnegative {A : Type u_1} {K : Type u_2} (price : K → ℝ) {B R : Book A K} {o : Order A K} (hb : ∀ (a : A), 0 ≤ B.cash a) (ho : o.buy = true) (h : reserve price B o = some R) (a : A) :
                                0 ≤ R.cash a
                                theorem MindFormal.A617Market.Auction.resting_price {A : Type u_1} {K : Type u_2} (price : K → ℝ) {B : Book A K} {o : Order A K} {f : Fill A K} (h : (matchOrder price B o).2 = some f) :
                                ∃ old ∈ B.orders, executable price o old ∧ f.paid = old.price ∧ f.buyer ≠ f.seller