3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-29 17:38:45 +00:00
Commit graph

147 commits

Author SHA1 Message Date
Caleb Stanford
2c02264a94
Regex solver updates (#4636)
* std::cout debugging statements

* comment out std::cout debugging as this is now a shared fork

* convert std::cout to TRACE statements for seq_rewriter and seq_regex

* add cases to min_length and max_length for regexes

* bug fix

* update min_length and max_length functions for REs

* initial pass on simplifying derivative normal forms by eliminating redundant predicates locally

* add seq_regex_brief trace statements

* working on debugging ref count issue

* fix ref count bug and convert trace statements to seq_regex_brief

* add compact tracing for cache hits/misses

* seq_regex fix cache hit/miss tracing and wrapper around is_nullable

* minor

* label and disable more experimental changes for testing

* minor documentation / tracing

* a few more @EXP annotations

* dead state elimination skeleton code

* progress on dead state elimination

* more progress on dead state elimination

* refactor dead state class to separate self-contained state_graph class

* finish factoring state_graph to only work with unsigned values, and implement separate functionality for expr* logic

* implement get_all_derivatives, add debug tracing

* trace statements for debugging is_nullable loop bug

* fix is_nullable loop bug

* comment out local nullable change and mark experimental

* pretty printing for state_graph

* rewrite state graph to remove the fragile assumption that all edges from a state are added at a time

* start of general cycle detection check + fix some comments

* implement full cycle detection procedure

* normalize derivative conditions to form 'ele <= a'

* order derivative conditions by character code

* fix confusing names m_to and m_from

* assign increasing state IDs from 1 instead of using get_id on AST node

* remove elim_condition call in get_dall_derivatives

* use u_map instead of uint_map to avoid memory leak

* remove unnecessary call to is_ground

* debugging

* small improvements to seq_regex_brief tracing

* fix bug on evil2 example

* save work

* new propagate code

* work in progress on using same seq sort for deriv calls

* avoid re-computing derivatives: use same head var for every derivative call

* use min_length on regexes to prune search

* simple implementation of can_be_in_cycle using rank function idea

* add a disabled experimental change

* minor cleanup comments, etc.

* seq_rewriter cleanup for PR

* typo noticed by Nikolaj

* move state graph to util/state_graph

* re-add accidentally removed line

* clean up seq_regex code removing obsolete functions and comments

* a few more cleanup items

* oops, missed merge change to fix compilation

* disabled change to lift unions to the top level and treat them seperately in seq_regex solver

* added get_overapprox_regex to over-approximate regex membership constraints

* replace calls to is_epsilon with a centrally available method in seq_decl_plugin

* simplifications and modifications in get_overapprox_regex and related

* added approximation support for sequence expressions that use ite

* removed is_app check that was redundant

* tweak differences with upstream

* rewrite derivative leaves

* enable Antimorov-style derivatives via lifting unions in the solver

* TODO placeholders for outputting state graph

* change order in seq_regex propagate_in_re

* implement a more restricted form of Antimorov derivatives via a special op code to indicate lifting unions

* minor

* new Antimorov optimizations based on BDD compatibility checking

* seq regex tracing for # of derivatives

* fix get_cofactors (currently this fix is buggy)

* partially revert get_cofactors buggy change

* re-implement get_cofactors to more efficiently explore nodes in the derivative expression

* dgml generation for state graph

* fix release build

* improved dgml output

* bug fixes in dgml generation

* dot output support for state_graph and moved dgml and dot output under CASSERT

* updated tracing of what regex corresponds to what state id with /tr:state_graph

* clean up & document Antimorov derivative support

* remove op cache tracing

* remove re_rank experimental idea

* small fix

* fix Antimorov derivative (important change for the good performance)

* remove unused and unnecessary code

* implemented simpler efficient get_cofactors alternative mk_deriv_accept

* simplifications in propagate_accept, and trace unusual cases

* document the various seq_regex tracing & debugging command-line options

* fix debug build (broken tracing)

* guard eager Antimorov lifting for possible disabling

* fix bug in propagate_accept Rule 1

* disable eager version of Antimorov lifting for performance reasons

* remove some remaining obsolete comments

Co-authored-by: calebstanford-msr <t-casta@microsoft.com>
Co-authored-by: Margus Veanes <margus@microsoft.com>
2020-08-13 12:47:36 -07:00
Margus Veanes
8137143ada
string to regex approximation used to strengthen membership constraints (#4610)
* string to regex approximation used to strengthen membership constraints

* fixed pull request comments
2020-08-01 16:45:00 -07:00
Nuno Lopes
23e6adcad3 fix a couple hundred deref-after-free bugs due to .c_str() on a temporary string 2020-07-11 20:24:45 +01:00
Nikolaj Bjorner
d0e20e44ff booyah
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-04 15:56:30 -07:00
Nikolaj Bjorner
5a2b6d9c92 bounds on loop expressions 2020-06-11 00:04:41 -07:00
Nikolaj Bjorner
bfb5c95b9a use op-cache for is-nullable
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-06-02 13:30:18 -07:00
Nikolaj Bjorner
084cd335eb add (disabled) stubs for decomposing re-membership on regex
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-31 12:25:21 -07:00
Nikolaj Bjorner
c92a63690d enable parsing (_ char ..)
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-29 17:47:24 -07:00
Nikolaj Bjorner
f381d51c83 update badge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-29 14:04:12 -07:00
calebstanford-msr
c939195c10
add regex support for reverse and left/right derivative rewriting (#4477)
* partial work on adding 'reverse' (broken code)

* new op codes for derivative and reverse + associated rewrite rules

* incorporate reverses and derivatives in rewriter + some fixes

* enable rewriting str.in_re constraints with right derivative
2020-05-29 13:00:37 -07:00
Nikolaj Bjorner
94ffd63b51 change to iterative unfolding left build broken for some time
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-26 21:25:53 -07:00
Nikolaj Bjorner
a97bc65af4 hoist co-factors eagerly without adding axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-25 15:10:45 -07:00
Nikolaj Bjorner
eb3f20832e initial pass at using derivatives in regex unfolding
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-23 11:53:07 -07:00
Nikolaj Bjorner
5844964d95 rename temporary macro
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 17:17:51 -07:00
Nikolaj Bjorner
1def58bc9f optional unicode mode
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-17 19:06:34 -07:00
Nikolaj Bjorner
fc8dfe3e40 seq
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-17 05:35:32 -07:00
Nikolaj Bjorner
34cc60410f additional str/re operators, remove encoding option from zstring
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-17 05:08:36 -07:00
Nikolaj Bjorner
363690791a update TBD
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-16 14:34:39 -07:00
Nikolaj Bjorner
21c4d451d8 parse RegLan
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-16 14:26:53 -07:00
Nikolaj Bjorner
4753d93bb7 add some of the SMTLIB2.6 conventions and features to strings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-16 14:00:02 -07:00
Murphy Berzish
1f15033ca2
z3str3: remove legacy code (#4215)
* z3str3: remove legacy fixed-length overlap testing

parameter smt.str.fixed_length_overlap_models has been deprecated

* z3str3: remove legacy length/value testing algorithm and binary search heuristic

the following parameters are deprecated:
smt.str.use_binary_search
smt.str.binary_search_start
smt.str.fixed_length_models (the fixed-length model construction is now always used)

* z3str3: remove legacy regex unroll methods

* z3str3: remove unused methods and member variables
2020-05-06 13:07:04 -07:00
Nikolaj Bjorner
03ba268219 more replace rewrites #4084
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-24 00:25:36 -07:00
Nikolaj Bjorner
95a78b2450
updates to seq and bug fixes (#4056)
* na

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4037

* nicer output for skolem functions

* more overhaul of seq, some bug fixes

* na

* added offset_eq file

* na

* fix #4044

* fix #4040

* fix #4045

* updated ignore

* new rewrites for indexof based on #4036

* add shortcuts

* updated ne solver for seq, fix #4025

* use pair vectors for equalities that are reduced by seq_rewriter

* use erase_and_swap

* remove unit-walk

* na

* add check for #3200

* nits

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* name a type

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* remove fp check

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* remove unsound axiom instantiation for non-contains

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix rewrites

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4053

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix #4052

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-22 13:18:55 -07:00
Nikolaj Bjorner
835b57b775 fix #3961 fix #3940
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-14 17:33:44 -07:00
Nikolaj Bjorner
57d430b3fd fix #3700
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-02 06:38:14 -07:00
Nikolaj Bjorner
ce0ccc2e9e fix #2860
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-24 16:33:57 -06:00
Nikolaj Bjorner
ab5905cf7f some adjustments for stack use on large strings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-12 22:08:24 -08:00
Nikolaj Bjorner
489448b869 fix #2762, fix #2750, add iterative unrolling to help on termination on sat instances (to address non-termination in #2759 and #2762)
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-11-30 18:05:24 -08:00
Nikolaj Bjorner
4ce6b53d95 fix #2640
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-16 20:40:03 -07:00
Nikolaj Bjorner
71d68b8fe0 fix #2445 fix #2519
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-13 20:24:14 -07:00
Nikolaj Bjorner
48e996241e fix initialization order
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-09-20 10:17:27 -07:00
Nikolaj Bjorner
cd0cd82eb7 add rewrites for #2575
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-09-20 08:55:53 -07:00
Nikolaj Bjorner
12034df11a add rewrites for #2575
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-09-20 02:16:30 -07:00
Nikolaj Bjorner
2d5714a5d4 fixing #2443 #2445 #2447 #2448
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-08-02 15:06:34 -07:00
Nikolaj Bjorner
584eee2cf4 fixing #2448 and #2445 and #2443
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-08-02 15:06:34 -07:00
Nikolaj Bjorner
6e994f9279 temporarily disable delete
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-29 20:09:33 +03:00
Nikolaj Bjorner
335543b374 adding comparison #2360
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-28 21:14:58 -07:00
Nikolaj Bjorner
6fdef691e5 fix #2316
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-02 16:37:38 -07:00
Nikolaj Bjorner
cccd37101e fix #2314
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-01 20:34:58 -07:00
Nikolaj Bjorner
b2845d888e add get_lstring per #2286
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-22 18:32:57 +04:00
Nikolaj Bjorner
3c8fd83c97 implementing last-index-of #2089
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-22 12:29:50 -07:00
Nikolaj Bjorner
2aa7ccc4a9 hide bit-vector dependencies under seq_util
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-12-03 08:45:17 -08:00
Nikolaj Bjorner
e96f9de70b perf #1988
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-11-29 06:02:32 -08:00
Nikolaj Bjorner
6ddbc9cd38 overhaul of regular expression membership solving. Use iterative deepening and propagation, coallesce intersections
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-11-24 15:26:39 -08:00
Nikolaj Bjorner
f591e0948a fix #1841
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-11-22 15:28:33 -08:00
Nikolaj Bjorner
aeb4d1864d clean up suffix/prefix rewriting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-11-22 11:39:34 -08:00
Nikolaj Bjorner
498fa87993 seq rewriting fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-11-22 10:48:49 -08:00
Bruce Mitchener
76eb7b9ede Use nullptr. 2018-02-12 14:05:55 +07:00
Bruce Mitchener
b7d1753843 Use override rather than virtual. 2018-02-09 21:19:27 +07:00
Nikolaj Bjorner
61934d8106 align semantics of re.allchar with string proposal. #1475
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-02-07 20:08:15 -08:00