@@ -2442,6 +2442,180 @@ public BoolExpr MkSetSubset(ArrayExpr arg1, ArrayExpr arg2)
24422442
24432443 #endregion
24442444
2445+ #region Finite Sets
2446+
2447+ /// <summary>
2448+ /// Create a finite set sort over the given element sort.
2449+ /// </summary>
2450+ public FiniteSetSort MkFiniteSetSort ( Sort elemSort )
2451+ {
2452+ Debug . Assert ( elemSort != null ) ;
2453+
2454+ CheckContextMatch ( elemSort ) ;
2455+ return new FiniteSetSort ( this , elemSort ) ;
2456+ }
2457+
2458+ /// <summary>
2459+ /// Check if a sort is a finite set sort.
2460+ /// </summary>
2461+ public bool IsFiniteSetSort ( Sort s )
2462+ {
2463+ Debug . Assert ( s != null ) ;
2464+
2465+ CheckContextMatch ( s ) ;
2466+ return Native . Z3_is_finite_set_sort ( nCtx , s . NativeObject ) != 0 ;
2467+ }
2468+
2469+ /// <summary>
2470+ /// Get the element sort (basis) of a finite set sort.
2471+ /// </summary>
2472+ public Sort GetFiniteSetSortBasis ( Sort s )
2473+ {
2474+ Debug . Assert ( s != null ) ;
2475+
2476+ CheckContextMatch ( s ) ;
2477+ return Sort . Create ( this , Native . Z3_get_finite_set_sort_basis ( nCtx , s . NativeObject ) ) ;
2478+ }
2479+
2480+ /// <summary>
2481+ /// Create an empty finite set.
2482+ /// </summary>
2483+ public Expr MkFiniteSetEmpty ( Sort setSort )
2484+ {
2485+ Debug . Assert ( setSort != null ) ;
2486+
2487+ CheckContextMatch ( setSort ) ;
2488+ return Expr . Create ( this , Native . Z3_mk_finite_set_empty ( nCtx , setSort . NativeObject ) ) ;
2489+ }
2490+
2491+ /// <summary>
2492+ /// Create a singleton finite set.
2493+ /// </summary>
2494+ public Expr MkFiniteSetSingleton ( Expr elem )
2495+ {
2496+ Debug . Assert ( elem != null ) ;
2497+
2498+ CheckContextMatch ( elem ) ;
2499+ return Expr . Create ( this , Native . Z3_mk_finite_set_singleton ( nCtx , elem . NativeObject ) ) ;
2500+ }
2501+
2502+ /// <summary>
2503+ /// Create the union of two finite sets.
2504+ /// </summary>
2505+ public Expr MkFiniteSetUnion ( Expr s1 , Expr s2 )
2506+ {
2507+ Debug . Assert ( s1 != null ) ;
2508+ Debug . Assert ( s2 != null ) ;
2509+
2510+ CheckContextMatch ( s1 ) ;
2511+ CheckContextMatch ( s2 ) ;
2512+ return Expr . Create ( this , Native . Z3_mk_finite_set_union ( nCtx , s1 . NativeObject , s2 . NativeObject ) ) ;
2513+ }
2514+
2515+ /// <summary>
2516+ /// Create the intersection of two finite sets.
2517+ /// </summary>
2518+ public Expr MkFiniteSetIntersect ( Expr s1 , Expr s2 )
2519+ {
2520+ Debug . Assert ( s1 != null ) ;
2521+ Debug . Assert ( s2 != null ) ;
2522+
2523+ CheckContextMatch ( s1 ) ;
2524+ CheckContextMatch ( s2 ) ;
2525+ return Expr . Create ( this , Native . Z3_mk_finite_set_intersect ( nCtx , s1 . NativeObject , s2 . NativeObject ) ) ;
2526+ }
2527+
2528+ /// <summary>
2529+ /// Create the difference of two finite sets.
2530+ /// </summary>
2531+ public Expr MkFiniteSetDifference ( Expr s1 , Expr s2 )
2532+ {
2533+ Debug . Assert ( s1 != null ) ;
2534+ Debug . Assert ( s2 != null ) ;
2535+
2536+ CheckContextMatch ( s1 ) ;
2537+ CheckContextMatch ( s2 ) ;
2538+ return Expr . Create ( this , Native . Z3_mk_finite_set_difference ( nCtx , s1 . NativeObject , s2 . NativeObject ) ) ;
2539+ }
2540+
2541+ /// <summary>
2542+ /// Check for membership in a finite set.
2543+ /// </summary>
2544+ public BoolExpr MkFiniteSetMember ( Expr elem , Expr set )
2545+ {
2546+ Debug . Assert ( elem != null ) ;
2547+ Debug . Assert ( set != null ) ;
2548+
2549+ CheckContextMatch ( elem ) ;
2550+ CheckContextMatch ( set ) ;
2551+ return ( BoolExpr ) Expr . Create ( this , Native . Z3_mk_finite_set_member ( nCtx , elem . NativeObject , set . NativeObject ) ) ;
2552+ }
2553+
2554+ /// <summary>
2555+ /// Get the cardinality of a finite set.
2556+ /// </summary>
2557+ public Expr MkFiniteSetSize ( Expr set )
2558+ {
2559+ Debug . Assert ( set != null ) ;
2560+
2561+ CheckContextMatch ( set ) ;
2562+ return Expr . Create ( this , Native . Z3_mk_finite_set_size ( nCtx , set . NativeObject ) ) ;
2563+ }
2564+
2565+ /// <summary>
2566+ /// Check if one finite set is a subset of another.
2567+ /// </summary>
2568+ public BoolExpr MkFiniteSetSubset ( Expr s1 , Expr s2 )
2569+ {
2570+ Debug . Assert ( s1 != null ) ;
2571+ Debug . Assert ( s2 != null ) ;
2572+
2573+ CheckContextMatch ( s1 ) ;
2574+ CheckContextMatch ( s2 ) ;
2575+ return ( BoolExpr ) Expr . Create ( this , Native . Z3_mk_finite_set_subset ( nCtx , s1 . NativeObject , s2 . NativeObject ) ) ;
2576+ }
2577+
2578+ /// <summary>
2579+ /// Map a function over all elements in a finite set.
2580+ /// </summary>
2581+ public Expr MkFiniteSetMap ( Expr f , Expr set )
2582+ {
2583+ Debug . Assert ( f != null ) ;
2584+ Debug . Assert ( set != null ) ;
2585+
2586+ CheckContextMatch ( f ) ;
2587+ CheckContextMatch ( set ) ;
2588+ return Expr . Create ( this , Native . Z3_mk_finite_set_map ( nCtx , f . NativeObject , set . NativeObject ) ) ;
2589+ }
2590+
2591+ /// <summary>
2592+ /// Filter a finite set with a predicate.
2593+ /// </summary>
2594+ public Expr MkFiniteSetFilter ( Expr f , Expr set )
2595+ {
2596+ Debug . Assert ( f != null ) ;
2597+ Debug . Assert ( set != null ) ;
2598+
2599+ CheckContextMatch ( f ) ;
2600+ CheckContextMatch ( set ) ;
2601+ return Expr . Create ( this , Native . Z3_mk_finite_set_filter ( nCtx , f . NativeObject , set . NativeObject ) ) ;
2602+ }
2603+
2604+ /// <summary>
2605+ /// Create a finite set containing integers in the range [low, high].
2606+ /// </summary>
2607+ public Expr MkFiniteSetRange ( Expr low , Expr high )
2608+ {
2609+ Debug . Assert ( low != null ) ;
2610+ Debug . Assert ( high != null ) ;
2611+
2612+ CheckContextMatch ( low ) ;
2613+ CheckContextMatch ( high ) ;
2614+ return Expr . Create ( this , Native . Z3_mk_finite_set_range ( nCtx , low . NativeObject , high . NativeObject ) ) ;
2615+ }
2616+
2617+ #endregion
2618+
24452619 #region Sequence, string and regular expressions
24462620
24472621 /// <summary>
0 commit comments