[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlaplus] Re: action never enabled




Hi Jones,

Here are the constant values.  By the way, thank you very much for helping me out!

liquidityBound <- 10
coin0Init <- 100
coin1Init <- 1000
lowerZero <- 80
upperZero <- 120

On Friday, December 24, 2021 at 3:50:21 PM UTC-8 jone...@xxxxxxxxx wrote:
Hi,

Yeah, nothing caught my eye… Could you give me the constant values for me to test locally?

Jones


On Fri, 24 Dec 2021 at 19:50, Mark Ettinger <jetti...@xxxxxxxxx> wrote:
Here is the actual spec:

----------------------------- MODULE uniswapV1 -----------------------------
EXTENDS Naturals, Integers
CONSTANTS liquidityBound, coin0Init, coin1Init, upperZero, lowerZero
VARIABLES coin0, coin1, liquidityTokens

max(a,b) == IF a > b THEN a ELSE b

outputPrice(delta_y, coin_x, coin_y) == ((delta_y * coin_x) \div (coin_y - delta_y)) + 1
inputPrice(delta_x, coin_x, coin_y) ==  (delta_x * coin_y) \div (coin_x + delta_x)

TypeOK == /\ coin0 \in Nat
          /\ coin1 \in Nat
          /\ (coin0 = 0 <=> coin1 = 0)
          /\ coin0 < upperZero
          /\ coin0 > lowerZero

tradeOneForZero == \exists delta_1 \in 1..outputPrice(coin0-1, coin1, coin0):
        /\ coin1' = coin1 + delta_1
        /\ coin0' = coin0 - inputPrice(delta_1, coin1, coin0)
        /\ liquidityTokens' = liquidityTokens
       
tradeZeroForOne == \exists delta_0 \in 1..outputPrice(coin1-1, coin0, coin1):
        /\ coin0' = coin0 + delta_0
        /\ coin1' = coin1 - inputPrice(delta_0, coin0, coin1)
        /\ liquidityTokens' = liquidityTokens
                                                             
Init == coin0 = coin0Init /\ coin1 = coin1Init /\ liquidityTokens = max(coin0,coin1)
\*Next == tradeZeroForOne \/ tradeOneForZero
Next == tradeOneForZero \/ tradeZeroForOne

Spec == Init /\ [][Next]_<<coin0, coin1, liquidityTokens>>
=============================================================================

On Friday, December 24, 2021 at 2:13:46 PM UTC-8 jone...@xxxxxxxxx wrote:
Hi,

No problem. I can't think of a solution unless you show a reduced (if possible) version of your spec?

Jones

On Friday, 24 December 2021 at 19:03:36 UTC-3 jetti...@xxxxxxxxx wrote:
 Sorry, I mistyped.  Indeed my spec is already:

Spec == Init /\ [][Next]_vars

On Friday, December 24, 2021 at 1:53:59 PM UTC-8 jone...@xxxxxxxxx wrote:
Hello,

From your example, it seems Spec should be: Init /\ [][Next]_vars, assuming vars is already a tuple/sequence. I am not sure if that solves your problem, though.

Jones

On Friday, 24 December 2021 at 13:59:20 UTC-3 jetti...@xxxxxxxxx wrote:

TLA+ newbie here with what is probably a newbie-ish question.  I'll describe it abstractly with actions A and B.   My spec has the form:

Next == A \/ B
Spec == Init /\ []Next_<<vars>>

When I run TLC I get a warning "B is never enabled".  If I change the ordering in Next to:

Next == B \/ A

I get the warning "A is never enabled."  Am I missing something obvious about disjunction?

Thanks for any insights in advance!

--
You received this message because you are subscribed to a topic in the Google Groups "tlaplus" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tlaplus/xSLCjuLi9ck/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tlaplus+u...@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/ce797f94-fd78-4dc8-bf46-267c5e91ccfbn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/d64f4b55-5335-4118-ad56-0c283b098328n%40googlegroups.com.