@@ -1861,6 +1861,15 @@ def is_lambda(self):
1861
1861
"""
1862
1862
return Z3_is_lambda (self .ctx_ref (), self .ast )
1863
1863
1864
+ def __getitem__ (self , arg ):
1865
+ """Return the Z3 expression `self[arg]`.
1866
+ """
1867
+ if z3_debug ():
1868
+ _z3_assert (self .is_lambda (), "quantifier should be a lambda expression" )
1869
+ arg = self .sort ().domain ().cast (arg )
1870
+ return _to_expr_ref (Z3_mk_select (self .ctx_ref (), self .as_ast (), arg .as_ast ()), self .ctx )
1871
+
1872
+
1864
1873
def weight (self ):
1865
1874
"""Return the weight annotation of `self`.
1866
1875
@@ -4274,6 +4283,9 @@ def __getitem__(self, arg):
4274
4283
def default (self ):
4275
4284
return _to_expr_ref (Z3_mk_array_default (self .ctx_ref (), self .as_ast ()), self .ctx )
4276
4285
4286
+ def is_array_sort (a ):
4287
+ return Z3_get_sort_kind (a .ctx .ref (), Z3_get_sort (a .ctx .ref (), a .ast )) == Z3_ARRAY_SORT
4288
+
4277
4289
4278
4290
def is_array (a ):
4279
4291
"""Return `True` if `a` is a Z3 array expression.
@@ -4412,7 +4424,7 @@ def Update(a, i, v):
4412
4424
proved
4413
4425
"""
4414
4426
if z3_debug ():
4415
- _z3_assert (is_array (a ), "First argument must be a Z3 array expression" )
4427
+ _z3_assert (is_array_sort (a ), "First argument must be a Z3 array expression" )
4416
4428
i = a .domain ().cast (i )
4417
4429
v = a .range ().cast (v )
4418
4430
ctx = a .ctx
@@ -4425,7 +4437,7 @@ def Default(a):
4425
4437
proved
4426
4438
"""
4427
4439
if z3_debug ():
4428
- _z3_assert (is_array (a ), "First argument must be a Z3 array expression" )
4440
+ _z3_assert (is_array_sort (a ), "First argument must be a Z3 array expression" )
4429
4441
return a .default ()
4430
4442
4431
4443
@@ -4456,7 +4468,7 @@ def Select(a, i):
4456
4468
True
4457
4469
"""
4458
4470
if z3_debug ():
4459
- _z3_assert (is_array (a ), "First argument must be a Z3 array expression" )
4471
+ _z3_assert (is_array_sort (a ), "First argument must be a Z3 array expression" )
4460
4472
return a [i ]
4461
4473
4462
4474
@@ -4511,7 +4523,7 @@ def Ext(a, b):
4511
4523
"""
4512
4524
ctx = a .ctx
4513
4525
if z3_debug ():
4514
- _z3_assert (is_array (a ) and is_array (b ), "arguments must be arrays" )
4526
+ _z3_assert (is_array_sort (a ) and is_array (b ), "arguments must be arrays" )
4515
4527
return _to_expr_ref (Z3_mk_array_ext (ctx .ref (), a .as_ast (), b .as_ast ()), ctx )
4516
4528
4517
4529
def SetHasSize (a , k ):
0 commit comments