from sage.all import PolynomialRing, ZZ

pr = PolynomialRing(ZZ, ('a', 'b', 'X1', 'X2', 'Y1', 'Y2'), 6)
a, b, X1, X2, Y1, Y2 = pr.gens()
ZZ1, ZZZ1, ZZ2, ZZZ2 = 1, 1, 1, 1
b2 = 2 * b
b4 = 4 * b
half = 1 / 2
Z1, Z2 = 1, 1
formula = {}
A = Z1 ** 2
formula['A'] = A
B = Z2 ** 2
formula['B'] = B
t0 = Z1 + Z2
formula['t0'] = t0
t1 = t0 ** 2
formula['t1'] = t1
t2 = t1 - A
formula['t2'] = t2
C = t2 - B
formula['C'] = C
D = X1 * Z2
formula['D'] = D
E = X2 * Z1
formula['E'] = E
F = Y1 * B
formula['F'] = F
G = Y2 * A
formula['G'] = G
H = D - E
formula['H'] = H
t3 = F - G
formula['t3'] = t3
I = 2 * t3
formula['I'] = I
II = I ** 2
formula['II'] = II
J = C * H
formula['J'] = J
t4 = J * H
formula['t4'] = t4
K = 4 * t4
formula['K'] = K
t5 = D + E
formula['t5'] = t5
t6 = t5 * K
formula['t6'] = t6
t7 = 2 * II
formula['t7'] = t7
X3 = t7 - t6
formula['X3'] = X3
JJ = J ** 2
formula['JJ'] = JJ
t8 = J + I
formula['t8'] = t8
t9 = t8 ** 2
formula['t9'] = t9
t10 = D * K
formula['t10'] = t10
t11 = t9 - JJ
formula['t11'] = t11
t12 = t11 - II
formula['t12'] = t12
t13 = t10 - X3
formula['t13'] = t13
t14 = K ** 2
formula['t14'] = t14
t15 = F * t14
formula['t15'] = t15
t16 = t12 * t13
formula['t16'] = t16
Y3 = t16 - t15
formula['Y3'] = Y3
Z3 = 2 * JJ
formula['Z3'] = Z3
