formalsec / smtml Goto Github PK
View Code? Open in Web Editor NEWA Multi Back-end Front-end for SMT Solvers in OCaml
Home Page: https://formalsec.github.io/smtml/
License: GNU General Public License v3.0
A Multi Back-end Front-end for SMT Solvers in OCaml
Home Page: https://formalsec.github.io/smtml/
License: GNU General Public License v3.0
// inherit parent's constructor
var code = members.__parent.toString();
var args = code.substring( code.indexOf("(")+1, code.indexOf(")") );
var inner_code = code.substring( code.indexOf("{")+1, code.lastIndexOf("}") );
eval('constructor = function ('+args+') {'+inner_code+'};');
Current state:
Is your feature request related to a problem? Please describe.
Currently, the operators extract
and concat
are defined as generic expressions in expression.ml
. However, these operators are only semantically defined over bit vector values.
Describe the solution you'd like
So, it is more semantically correct that the extract
and concat
operators are moved into the bvOp.ml
module as, respectively, triops and binops.
Describe alternatives you've considered
No alternatives.
Additional context
No additional context.
Ship the encoding with another solver that is quicker to install (Bitwuzla?). Is it possible to retain the z3_mappings implementation? Perhaps, utilize a stub z3 library that fails at runtime if z3 is not installed?
Introduced in #59
During symbolic executions, contexts without models are slightly faster than when this option is enabled. Models are only used for test-suite generation at the end of the analysis, accounting for only a fraction of the executed queries.
Mainly resistant due to operators types. Maybe we could type operators like this?
(* ty.ml *)
type _ t =
| Ty_int : [ `Ty_int ] t
| Ty_real : [ `Ty_real ] t
| Ty_bool : [ `Ty_bool ] t
| Ty_str : [ `Ty_str ] t
| Ty_bitv : int -> [ `Ty_bitv ] t
| Ty_fp : int -> [ `Ty_fp ] t
type _ unop =
| Abs : [< `Ty_real | `Ty_fp ] unop
| Ceil : [< `Ty_real | `Ty_fp ] unop
| Clz : [ `Ty_bitv ] unop
| Ctz : [ `Ty_bitv ] unop
| Floor : [< `Ty_real | `Ty_fp ] unop
| Is_nan : [ `Ty_fp ] unop
| Len : [ `Ty_str ] unop
| Neg : [< `Ty_int | `Ty_real | `Ty_bitv | `Ty_fp ] unop
| Nearest : [< `Ty_real | `Ty_fp ] unop
| Not : [< `Ty_bitv | `Ty_bool ] unop
| Sqrt : [< `Ty_real | `Ty_fp ] unop
| Trim : [ `Ty_str ] unop
| Trunc : [< `Ty_real | `Ty_fp ] unop
...
Related to OCamlPro/owi#122
Due to #60
Add a CI rule that maximise this criteria in opam to emulate the lower-bounds checking in opam-ci:
+removed,+count[version-lag,solution]
They are mapped to z3 but not evaluated in eval_numeric
and
it's heavy!
Hello,
I'm currently working on improving Owi
's test coverage, especially for symbolic interpretation.
OCamlPro/owi#96
Some z3 mappings
are missing.
For example, Ceil
and Floor
float unop.
https://github.com/formalsec/encoding/blob/4cd856eacc9fb23fdfcf4fd0b21d0de311ac2ae7/lib/z3_mappings.ml#L408
Do you plan to implement them?
Thanks
Maybe we could have something like this?
type nary = Add | Sub | Mul
type bary = And | Or
type sary = Concat
...
type nop =
| Int of nary
| Real of nary
| Bool of bary
| Str of sary
| ...
type expr =
...
| Nary of nop * expr list
Por exemplo:
antes era:
Program Print
(Val Int -1)
Agora รฉ:
>Program Print
(int.sub 5 6)
Is your feature request related to a problem? Please describe.
Currently, floating-point (fp) value lifting is done through string parsing of the fp numeral string representation. This is problematic as one cannot guarantee that this fp numeral string representation will be kept in future versions of Z3.
Describe the solution you'd like
Rather than parsing the floating-point numeral string, employ the OCaml Z3 bindings to decode floating-point values into the abstract syntax.
Describe alternatives you've considered
Alternatives have yet to be considered.
Additional context
No additional context.
Improve hc see https://fs.zapashcanon.fr/pdf/ter-report.pdf
Is your feature request related to a problem? Please describe.
Although the files in lib
are correctly named, it would help having them organised into sub-directories that aggregate related code. This feature would reduce mental effort in locating desired source files.
Describe the solution you'd like
For example, files related with the abstract syntax (e.g., intOp.ml
or floatOp.ml
) should be place in a directory titled syntax
.
Describe alternatives you've considered
Alternatives have yet to be considered.
Additional context
No additional context.
Some simplifications are missing/incomplete.
Current:
(int.add (int.add $_descending 3) 10)
Should be:
(int.add $_descending 13)
Undefined references just blow up with Not_found
๐ข
Model linear memory using arrays
Needed in order to allow for the completion of formalsec/ECMA-SL#20
Operators | Status | New Name |
---|---|---|
Typeof | โ | |
Neg | โ๏ธ | |
BitwiseNot | โ๏ธ | |
LogicalNot | โ๏ธ | |
IntToFloat | โ๏ธ | |
IntToString | โ๏ธ | |
IntToFourHex | โ | |
OctalToDecimal | โ | |
FloatToInt | โ๏ธ | |
FloatToString | โ๏ธ | |
ToInt | โ | |
ToInt32 | โ | |
ToUint16 | โ | |
ToUint32 | โ | |
IsNaN | โ๏ธ | |
StringToInt | โ๏ธ | |
StringToFloat | โ๏ธ | |
FromCharCode | โ๏ธ | |
FromCharCodeU | โ | |
ToCharCode | โ๏ธ | |
ToCharCodeU | โ | |
ToLowerCase | โ | |
ToUpperCase | โ | |
Trim | โ๏ธ | |
StringLen | โ๏ธ | Length |
StringLenU | โ | |
StringConcat | โ๏ธ | |
ObjectToList | โ | |
ObjectFields | โ | |
ArrayLen | โ | |
ListToArray | โ | |
ListHead | โ | Head |
ListTail | โ | Tail |
ListLen | โ | Length |
ListSort | โ | |
ListReverse | โ | Reverse |
ListRemoveLast | โ | |
TupleFirst | โ | Head |
TupleSecond | โ | Tail |
TupleLen | โ | Length |
FloatToByte | โ | |
Float32ToLEBytes | โ | |
Float32ToBEBytes | โ | |
Float64ToLEBytes | โ | |
Float64ToBEBytes | โ | |
Float32FromLEBytes | โ | |
Float32FromBEBytes | โ | |
Float64FromLEBytes | โ | |
Float64FromBEBytes | โ | |
BytesToString | โ | |
Random | โ | |
Abs | โ๏ธ | |
Sqrt | โ๏ธ | |
Ceil | โ๏ธ | |
Floor | โ๏ธ | |
Trunc | โ๏ธ | |
Exp | โ๏ธ | |
Log2 | โ | |
LogE | โ | |
Log10 | โ | |
Sin | โ | |
Cos | โ | |
Tan | โ | |
Sinh | โ | |
Cosh | โ | |
Tanh | โ | |
Asin | โ | |
Acos | โ | |
Atan | โ | |
Utf8Decode | โ | |
HexDecode | โ | |
ParseNumber | โ | |
ParseString | โ | |
ParseDate | โ |
Operator | Status | New Name |
---|---|---|
Plus | โ๏ธ | |
Minus | โ๏ธ | |
Times | โ๏ธ | |
Div | โ๏ธ | |
Modulo | โ๏ธ | |
Pow | โ๏ธ | |
BitwiseAnd | โ๏ธ | |
BitwiseOr | โ๏ธ | |
BitwiseXor | โ๏ธ | |
ShiftLeft | โ๏ธ | |
ShiftRight | โ๏ธ | |
ShiftRightLogical | โ๏ธ | |
LogicalAnd | โ๏ธ | |
LogicalOr | โ๏ธ | |
SCLogicalAnd | โ๏ธ | |
SCLogicalOr | โ๏ธ | |
Eq | โ๏ธ | |
NE | โ๏ธ | |
Lt | โ๏ธ | |
Gt | โ๏ธ | |
Le | โ๏ธ | |
Ge | โ๏ธ | |
ToPrecision | โ | |
ToExponential | โ | |
ToFixed | โ | |
ObjectMem | โ | |
StringNth | โ๏ธ | |
StringNthU | โ | |
StringSplit | โ | |
ArrayMake | โ | |
ArrayNth | โ | |
ListMem | โ | |
ListNth | โ | At |
ListAdd | โ | List_append_last |
ListPrepend | โ | List_append |
ListConcat | โ | Concat |
ListRemove | โ | |
ListRemoveNth | โ | |
TupleNth | โ | At |
IntToBEBytes | โ | |
IntFromLEBytes | โ | |
UintFromLEBytes | โ | |
Min | โ๏ธ | |
Max | โ๏ธ | |
Atan2 | โ |
Operator | Status | New Name |
---|---|---|
ITE | โ๏ธ | |
StringSubstr | โ๏ธ | |
StringSubstrU | โ | |
ArraySet | โ | |
ListSet | โ | List_set |
Operator | Status |
---|---|
NAryLogicalAnd | โ |
NAryLogicalOr | โ |
ArrayExpr | โ๏ธ |
ListExpr | โ๏ธ |
TupleExpr | โ๏ธ |
Model:
(model
(symbol_1 f64 (f64 -338460706455329128135018695364373065576360054171204343201037173805357995568625611429596369334345869072216864991017687935090688.000000))
(symbol_2 i32 (i32 11821))
(symbol_0 f32 (f32 nan))
(symbol_3 i64 (i64 0)))
Error on 2.
Provide data structures like sets and maps for hash consed expressions?
Add a get_statistics
function that returns a statistics type, ensuring that each entry is correctly typed to allow for easy statistics merging.
Due to OCamlPro/owi#198
Is your feature request related to a problem? Please describe.
Currently, one must directly use the variant representations from Expressions
and Types
to build expressions of the abstract syntax. This make expression building an extremely painful process.
Describe the solution you'd like
To solve this, create the following six modules: Integer
, Real
, Boolean
, Strings
, FloatingPoint
and BitVector
that expose mk_
function constructors. The obvious advantage of this feature is the employment of ocamldoc for documention.
Describe alternatives you've considered
No alternatives.
Additional context
No additional context required.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.