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

[tlaplus] Re: action never enabled



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 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/ce797f94-fd78-4dc8-bf46-267c5e91ccfbn%40googlegroups.com.