3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
Commit graph

151 commits

Author SHA1 Message Date
Margus Veanes 93bc1bc983 extended calculation of info for regexes, updated tracing of state_graph with regex info 2020-08-21 13:00:36 -07:00
Margus Veanes de65c61ebc
renamed re to rex and added custom pretty printing for info (#4650) 2020-08-19 19:20:14 -07:00
Nikolaj Bjorner ed258ca019 approximate min-length for complements
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-18 22:04:09 -07:00
Margus Veanes c50e869e5a
computing and memoizing info for regexes (#4647)
* computing and memoizing info for regex expressions

* computing and memoizing info for regex expressions

* took care of comments of the related pull request

* removed +1 from min_length of ite

* added to_str method for re and fixed STRACE bug in get_info_rec
2020-08-18 20:01:59 -07:00
Nikolaj Bjorner c0a07f9229 tidy
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-14 04:26:59 -07:00
Margus Veanes 1233cb4621 added missing const declarations that caused build failure on some platforms 2020-08-13 20:04:35 -07:00
Margus Veanes 1567587b97 fixed bug in seq_unit 2020-08-13 18:14:21 -07:00
Margus Veanes e80b143e71 updated detection of when parenthesis can be omitted to cover empty and epsilon 2020-08-13 18:14:21 -07:00
Margus Veanes ae413365e9 further PR comment fixes 2020-08-13 18:14:21 -07:00
Margus Veanes 5f9a326910 took care of comments for related PR 2020-08-13 18:14:21 -07:00
Margus Veanes 2c33bd6faf pp support for regex expressions is more-or-less standard syntax 2020-08-13 18:13:51 -07:00
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
Caleb Stanford 976e4c91b0
Integrate new regex solver (#4602)
* 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

* remove experimental functionality for integration

* fix compilation

* remove some tracing and TODOs

* remove old comment

* update copyright dates to 2020

* feedback from Nikolaj

* use [] for map access

* make state_graph methods constant

* avoid recursion in mark_dead_recursive and mark_live_recursive

* a possible bug fix in propagate_nonempty

* write down list of invariants in state_graph

* implement partial invariant check and insert CASSERT statements

* expand on invariant check and tracing

* finish state graph invariant check

* minor tweaks

* regex propagation: convert first two axioms to propagations

* remove obsolete regex solver functionality

Co-authored-by: calebstanford-msr <t-casta@microsoft.com>
2020-07-30 13:54:49 -07:00
Nikolaj Bjorner b71a64365d sketch fixed-length heuristic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-27 19:34:32 -07:00
Nikolaj Bjorner e63992c8bd fix #4589
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-24 15:46:54 -07:00
Nikolaj Bjorner 780346c7ca address model generation bugs raised in #4518 and #4324
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-24 13:22:19 -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 5987d9ae20 cache computing strings and regexes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-02 11:14:29 -07:00
Nikolaj Bjorner 3b1149330d enable theory propagation of regex accept condition
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-06-17 13:42:40 -07:00
Nikolaj Bjorner 5a2b6d9c92 bounds on loop expressions 2020-06-11 00:04:41 -07:00
Nikolaj Bjorner e3d45b9850 refcount leaks
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-06-09 14:19:26 -07:00
Nikolaj Bjorner 4fdfc65b37 tune seq rewriting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-06-09 13:30:39 -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 dbd90e5f86 dbg proagate_eq
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-27 10:33:45 -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 d1d14111cb turn on Unicode parsing when they fit in 8 bits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-22 10:41:19 -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 c8c02060ee another module level ifdef for #4382
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-18 15:01:27 -07:00
Murphy Berzish 152d6338f8
fix hex digit radix in unicode escape (#4356) 2020-05-17 19:07: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 30f17b1509 fix #4355
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-17 12:28:30 -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 bfb38451d1 add unicode encoding back 2020-05-16 17:11:47 -07:00
Murphy Berzish 6f0a367357
add SMTLIB2.6 names for QF_SLIA and string-int conversion operators (#4341) 2020-05-16 14:31:47 -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
Nikolaj Bjorner 1ab2ad07be outline of unicode parsing #4333
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-05-16 13:36:43 -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 9c3f0190f4 fix #4069
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-23 20:53:13 -07:00
Nikolaj Bjorner 501aa7927d split into seq_axioms and seq_skolem
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-17 06:14:52 -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 a7aff1bcf0 fix regression on string ops
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-02 10:03:35 -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 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 541658fe02 move to abstract symbols
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-01-10 12:14:13 -08:00