@@ -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
@@ -4288,6 +4297,9 @@ def is_array(a):
4288
4297
"""
4289
4298
return isinstance (a , ArrayRef )
4290
4299
4300
+ def is_array_sort (a ):
4301
+ return _ast_kind (a .ctx (), a .sort ()) == Z3_ARRAY_SORT
4302
+
4291
4303
def is_const_array (a ):
4292
4304
"""Return `True` if `a` is a Z3 constant array.
4293
4305
@@ -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
@@ -4476,7 +4488,7 @@ def Map(f, *args):
4476
4488
if z3_debug ():
4477
4489
_z3_assert (len (args ) > 0 , "At least one Z3 array expression expected" )
4478
4490
_z3_assert (is_func_decl (f ), "First argument must be a Z3 function declaration" )
4479
- _z3_assert (all ([is_array (a ) for a in args ]), "Z3 array expected expected" )
4491
+ _z3_assert (all ([is_array_sort (a ) for a in args ]), "Z3 array expected expected" )
4480
4492
_z3_assert (len (args ) == f .arity (), "Number of arguments mismatch" )
4481
4493
_args , sz = _to_ast_array (args )
4482
4494
ctx = f .ctx
@@ -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_sort (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