Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge saw-core repo #1213

Merged
merged 2,231 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2231 commits
Select commit Hold shift + click to select a range
4b363b9
use eauto for intro + destructing, clean up CompMExtra a bit
m-yac Oct 19, 2020
9503def
Specialize some occurrences of the `Value` type to `TValue`.
Oct 19, 2020
d5633bc
Change `VVecType` to use `Natural` for its size argument.
Oct 19, 2020
d416a83
Add `VSort` constructor, and remove now-unnecessary `VType`.
Oct 20, 2020
3dd70af
Merge pull request #91 from GaloisInc/tvalue
Oct 20, 2020
a489c57
Support uninterpreted polymorphic functions in sbv/what4 backends.
Oct 19, 2020
7049e5c
Improve error messages for failed uninterpreted functions.
Oct 20, 2020
6d8cb06
add Exists and Forall ArgNames
m-yac Oct 20, 2020
066e7a8
Merge pull request #92 from GaloisInc/unint-poly
Oct 21, 2020
11f7891
Modify saw-core external-format parser to use fresh `ExtCns` indices.
Oct 22, 2020
138d862
Merge pull request #96 from GaloisInc/external-format
Oct 23, 2020
008e1a0
Fix type error in saw-core tests
Oct 27, 2020
9d14d49
Install reference implementation redirection for
robdockins Oct 28, 2020
920624e
Merge remote-tracking branch 'origin/master' into fast-f2
robdockins Oct 28, 2020
1e7a15d
Merge pull request #98 from GaloisInc/fast-f2
robdockins Oct 28, 2020
aa768b7
Add `TValue` constructor for `IntMod` type.
Oct 20, 2020
69707b4
Avoid using `error` within what4 backend.
Oct 21, 2020
337aa80
Add `VIntMod` constructor to `Value` datatype.
Oct 21, 2020
7fd75f9
Add `scIntModType` to SharedTerm library.
Oct 21, 2020
5a5d430
Add function `asIntModType` to Recognizer library.
Oct 21, 2020
8a80a19
Add constructor `FOTIntMod` to `FirstOrderType` datatype.
Oct 21, 2020
f01e444
Correctly handle uninterpreted functions on IntMod in sbv/what4 backe…
Oct 21, 2020
80c40b5
Remove duplicated code.
Oct 21, 2020
e2f714d
Add function `scToIntMod` to SharedTerm library.
Oct 22, 2020
363437f
Add `FOVIntMod` constructor to `FirstOrderValue` datatype.
Nov 3, 2020
7b6167e
saw-core-what4: Add IntModLabel to Labeler type.
Nov 3, 2020
47f6264
Use `safeSymbol` instead of `userSymbol` to avoid an error case.
Nov 3, 2020
7b04d2e
Merge pull request #93 from GaloisInc/intmod
Nov 3, 2020
6cfd194
Reimplement `getAllExtSet` and `getConstantSet` using `Data.IntSet`.
Nov 11, 2020
e2ac983
Merge pull request #100 from GaloisInc/intset
Nov 12, 2020
c881bbb
Add structured name support to SAWCore. This involves a new
robdockins Oct 15, 2020
a24ef5e
Move the names of external constants into a side lookup table
robdockins Oct 29, 2020
537dfc2
Add special handling for <interactive> names, and add a method
robdockins Oct 30, 2020
5ae1901
Add a method to directly resolve SAWCore names by URI
robdockins Oct 30, 2020
dc36a11
Have the What4 and SBV solver methods take the values to be
robdockins Oct 30, 2020
e146c8a
Merge pull request #87 from GaloisInc/structured-names
robdockins Nov 13, 2020
735ae41
Add recognizers for URI forms generated from Cryptol names,
robdockins Nov 2, 2020
0c3fa7c
Add a new evaluation method for SAWCore terms that prepares
robdockins Nov 2, 2020
2ab947a
Tweak the format for "fresh" names, and improve the pretty printer
robdockins Nov 3, 2020
b5238e7
Update to follow 'structured-names' branch.
robdockins Oct 15, 2020
516a5f1
Haddock fixes
robdockins Nov 16, 2020
94c8e51
Merge pull request #99 from GaloisInc/what4-eval3
robdockins Nov 16, 2020
d2b23e7
Merge pull request #26 from GaloisInc/structured-names
robdockins Nov 17, 2020
efd7592
Adapt to GaloisInc/cryptol#964 tc-errors.
Nov 19, 2020
d3cb3e3
Merge pull request #104 from GaloisInc/tc-errors
Nov 20, 2020
90b5d45
Convert from `ansi-wl-pprint` package to `prettyprinter`.
Nov 22, 2020
4955d8d
Add name to error message about uninterpreted higher-order functions.
Nov 16, 2020
ab87ce3
Merge pull request #102 from GaloisInc/saw-script-issue906
Nov 23, 2020
629717a
Switch from ansi-wl-pprint to the prettyprinter package.
Nov 20, 2020
a581a5b
Use custom document style type for semantic prettyprinter annotations.
Nov 22, 2020
784fb0c
Remove mentions of `ansi-wl-pprint` from cabal files.
Nov 22, 2020
a1c42e0
Rename `Doc` type synonym to `SawDoc`.
Nov 22, 2020
056ac76
Use standard prettyprinter combinators instead of locally-defined ones.
Nov 24, 2020
296bc6d
Merge pull request #106 from GaloisInc/prettyprinter
Nov 24, 2020
2d04786
Fix implementation of `fromIntMod` in concrete evaluation backend.
Nov 24, 2020
8b4df2d
Merge pull request #28 from GaloisInc/prettyprinter
Nov 24, 2020
93cd7bd
Merge pull request #109 from GaloisInc/fix-fromIntMod
Nov 25, 2020
8eefd67
Fix reference primitives. (#110)
andreistefanescu Nov 30, 2020
a7da849
Use OverloadedStrings for prettyprinter Doc type.
Dec 1, 2020
6411f4d
Use `FieldName` type synonym more consistently.
Dec 1, 2020
ea3a628
Define `type FieldName = Text` instead of `String`.
Dec 1, 2020
6fe1d76
Fix `translatePi` so that it properly translates bound variables.
Dec 2, 2020
573869e
Fix incorrect local variable environment when translating lambdas.
Dec 2, 2020
62e231e
Fix incorrect local variable environment when translating terms.
Dec 2, 2020
df1d75a
Heapster bound names (#29)
Dec 2, 2020
7708e10
re-generated Coq files
Dec 2, 2020
0fde1c7
Merge branch 'master' into bound-names
Dec 5, 2020
7978fdc
Merge pull request #32 from GaloisInc/bound-names
Dec 5, 2020
fb95f86
Merge branch 'master' into wip-heapster-merge
Dec 7, 2020
e6e7bf1
preparation for merge
Dec 7, 2020
2d5580e
Merge branch 'master' into wip-heapster
Dec 7, 2020
f6ecaa9
Merge branch 'wip-heapster-merge' of https://github.com/GaloisInc/saw…
Dec 7, 2020
8314b93
resolve missed conflict
Dec 7, 2020
9b93014
Avoid outputting any ANSI codes when color option is disabled.
Dec 7, 2020
5aa04fb
fixed pretty-printing for identifiers that start with "@" by adding p…
Dec 7, 2020
5a37203
fixed withLocalLocalEnvironment to save the entire environment, not j…
Dec 8, 2020
6a70bf3
Merge pull request #113 from GaloisInc/no-color
Dec 8, 2020
3694179
committed latest versions of generated Coq files
Dec 8, 2020
40a0b98
move IntroArg stuff from refinesM to refinesFun HintDb
m-yac Oct 20, 2020
17a7bad
changes for `no_errors_incr_list`
m-yac Dec 7, 2020
7b01a99
pull updated `CompM_itrees`
m-yac Dec 8, 2020
661dc3d
clean up `CompM_ITrees`
m-yac Dec 8, 2020
4b2d7e0
added an "explicit variable" form to the Coq AST, in place of identif…
Dec 8, 2020
b18f1a8
Make ruleOfProp return a `Maybe` instead of calling `error`.
Dec 7, 2020
e7664af
Remove redundant `$` in function applications with record syntax.
Dec 9, 2020
f61023e
Merge pull request #112 from GaloisInc/ruleOfProp
Dec 9, 2020
0158c66
whoops, bvToInt was actually intToBV!
Dec 9, 2020
72c3294
whoops, wrong definition for bvToInt
Dec 9, 2020
a0ca852
changed the way record projections are represented in Coq, to handle #34
Dec 10, 2020
56f6585
Fix incorrect implementation of `intModUnOp` in sbv backend.
Dec 10, 2020
40da877
Merge pull request #115 from GaloisInc/issue114
Dec 11, 2020
f0ed599
Adds bvShl and enables CryptolPrimitivesForSAWCore to build
Jan 5, 2021
943f03c
Merge pull request #111 from GaloisInc/text-fieldname
Jan 16, 2021
94868fe
Adapt to GaloisInc/saw-core#111, which uses Data.Text for FieldName.
Jan 16, 2021
f970f97
Merge pull request #36 from GaloisInc/text-fieldname
Jan 16, 2021
03ac637
Type check in context of private symbols
Jan 18, 2021
0ad5055
Fix broken Read instance for type Ident.
Jan 16, 2021
f77b75f
Merge pull request #122 from GaloisInc/read-ident
Jan 19, 2021
cef6848
Move ModuleName, Ident, and NameInfo declarations into new module.
Jan 16, 2021
b338136
Move ExtCns and related definitions to Verifier.SAW.Name.
Jan 16, 2021
1f05618
Move SAWNamingEnv type to Verifier.SAW.Name.
Jan 16, 2021
91c938d
Move more SAWNamingEnv-related functions into Verifier.SAW.Name.
Jan 17, 2021
acf9c40
Redefine `scFindBestName` in terms of `bestAlias`.
Jan 19, 2021
1a2f490
Merge pull request #123 from GaloisInc/name-module
Jan 19, 2021
4912ea1
Sort LANGUAGE pragmas and remove duplicates.
Jan 17, 2021
9b3dc10
Switch Lambda and Pi constructors to use Text instead of String.
Jan 17, 2021
eadbd70
Switch StringLit to use Text instead of String.
Jan 17, 2021
0aee352
Merge pull request #119 from GaloisInc/text-lambda
Jan 19, 2021
33d10d1
Adapt to GaloisInc/saw-core#119.
Jan 19, 2021
3efc468
Qualify Data.List import to fix GHC 8.10 compatibility check.
kquick Jan 19, 2021
13995d8
Merge pull request #125 from GaloisInc/qualified_list
kquick Jan 19, 2021
9dfb209
Switch from `GlobalDef` to `Constant` for definitions in .sawcore files.
Jan 16, 2021
145e831
Fix mismatched parser/printers for ModuleIdentifier in ExternalFormat.
Jan 16, 2021
3384748
Fix bug in cryptol-saw-core: Repl is a constructor, not a global.
Jan 16, 2021
f93b018
Switch scGlobalEnv from MVar to IORef using atomicModifyIORef'.
Jan 19, 2021
62490c8
Merge pull request #37 from GaloisInc/text-lambda
Jan 19, 2021
4913ed5
Merge branch 'master' into wip-heapster-merge
Jan 19, 2021
9631803
Make visibility of Cryptol symbols configurable
Jan 19, 2021
2ac0378
Fix cryptol-saw-core tests
Jan 19, 2021
30f26cd
Merge pull request #120 from GaloisInc/at-private-imports
Jan 19, 2021
1f8c714
Add GADTs language pragma to make ghc-8.10 happy.
Jan 20, 2021
db41a9b
Merge pull request #118 from GaloisInc/globaldef
Jan 20, 2021
317550f
Avoid calling slow `typeInferComplete` on already-typechecked terms.
Jan 21, 2021
2109f18
Merge pull request #127 from GaloisInc/faster-typechecker
Jan 21, 2021
9fa0c55
Merge pull request #33 from GaloisInc/wip-heapster-merge
Jan 21, 2021
2a1072f
Move entire saw-core-coq package into new `saw-core-coq` subdirectory.
Jan 21, 2021
c42c565
Merge remote-tracking branch 'saw-core-coq/master-subdirectory' into …
Jan 21, 2021
c8316b8
Merge pull request #128 from GaloisInc/merge-saw-core-coq
Jan 21, 2021
c7dae3f
Add new pretty-printing functions that take a SAWNamingEnv.
Jan 20, 2021
d5f4baa
Add naming-aware pretty-printing function `scShowTerm`.
Jan 20, 2021
d6c0cd6
Merge pull request #126 from GaloisInc/pp-term
Jan 22, 2021
2afee57
Fix implementation of `fromIntMod` in SBV backend.
Jan 22, 2021
00297b4
Fix implementation of `fromIntMod` in what4 backend.
Jan 22, 2021
f768823
Merge pull request #146 from GaloisInc/issue145
Jan 22, 2021
8d87981
Add congruence rule for IntModNum and extend `proveEq` to handle Z type.
Jan 22, 2021
17a26a2
Merge pull request #149 from GaloisInc/issue147
Jan 22, 2021
a22b5b0
experimental CI workflow for saw-core-coq
Ptival Jan 25, 2021
f6ebafd
saw-core-coq: workflows cannot be in subdirectories
Ptival Jan 25, 2021
85252a8
Adapt Conversion library to use `scGlobalDef` when building terms.
Jan 25, 2021
0d1051d
Merge pull request #152 from GaloisInc/issue151
Jan 25, 2021
0616203
Adapt to GaloisInc/cryptol#995 "Call stacks".
Jan 28, 2021
de21a45
Adapt to GaloisInc/cryptol#993 "Refactor evopts".
Jan 28, 2021
38aeb96
Adapt to GaloisInc/cryptol#1015 "Newtypes".
Jan 28, 2021
26a21f3
Merge pull request #153 from GaloisInc/update-cryptol
Jan 28, 2021
fd3db18
Port the main translation code from `crucible-saw` into the
robdockins Jan 5, 2021
ea9ec30
Don't depend on the crucible-saw package anymore, but use the
robdockins Jan 5, 2021
eb9ed6c
Remove use of the `Given` constraint in favor of direct argument pass…
robdockins Jan 5, 2021
c4ade9f
Utility for creating new SAWCoreState
robdockins Jan 8, 2021
13fc77e
Clean up unused code.
robdockins Jan 29, 2021
f6de4bb
Merge pull request #116 from GaloisInc/saw-what4-refactor
robdockins Jan 30, 2021
accc43c
Change the sort of saw-core type `Eq` from `sort 1` to `Prop`.
Jan 29, 2021
893416e
Merge pull request #154 from GaloisInc/eq-prop
Feb 1, 2021
5729c7d
Add dependent sum datatype `Sigma` to saw-core prelude.
Jan 29, 2021
06e6149
Merge pull request #155 from GaloisInc/sigma-type
Feb 1, 2021
312907f
Add an inductive `List` datatype to the saw-core prelude.
Jan 29, 2021
3927990
Merge pull request #156 from GaloisInc/list-type
Feb 1, 2021
c0edf96
Add SAW core emacs mode.
Sep 15, 2020
e06421a
Merge pull request #157 from GaloisInc/saw-core-mode
Feb 1, 2021
bf70f54
Update README.md
ajayeeralla Feb 12, 2021
9a7bd35
Update README.md
ajayeeralla Feb 12, 2021
430aa31
Update README.md
ajayeeralla Feb 12, 2021
bf92e92
Edit `rme/README.md`.
Feb 15, 2021
055cedb
Update to follow changes in What4 regarding floating-point and natura…
robdockins Feb 5, 2021
8671513
SBV upper bounds
robdockins Feb 6, 2021
43bac84
fix coq import bug (SAWVector.. -> SAWCoreVector..)
Feb 19, 2021
b9dd3d8
Merge pull request #158 from GaloisInc/demote-nat
robdockins Feb 22, 2021
f208f24
Avoid unnecessary uses of `GlobalDef` constructor.
Feb 16, 2021
02f2be2
Replace `GlobalDef` term constructor with `Primitive`.
Feb 16, 2021
4ceddbd
Merge pull request #163 from GaloisInc/primitive
Feb 22, 2021
f47be1f
Merge pull request #165 from GaloisInc/fix-coq-import-bug
ajayeeralla Feb 22, 2021
1e35e79
added tuple combinators to OpenTerm.hs
Apr 30, 2019
bec8bc0
added letOpenTerm
Aug 31, 2019
77ae448
added pair and tuple projection functions, as well as multi-arity lam…
Dec 16, 2019
7cc6582
added completeOpenTermType to get the type of an OpenTerm
Apr 8, 2020
8a6aeac
Expose implementation of OpenTerm and OpenTermM types.
Apr 23, 2020
d30fcb5
added sortOpenTerm
May 22, 2020
f3ad871
Merge pull request #166 from GaloisInc/openterm
Feb 23, 2021
25f60eb
Convert more uses of `String` to `Text`.
Jan 29, 2021
ed0d14a
Merge pull request #160 from GaloisInc/text-untyped-ast
Feb 23, 2021
dfecd26
Add stubs for new cryptol float primitives to cryptol-saw-core.
Mar 2, 2021
8bdf3b8
Adapt cryptol-saw-core to GaloisInc/cryptol#1075 "persist-solver".
Mar 2, 2021
78185d3
Merge pull request #175 from GaloisInc/update-cryptol
Mar 2, 2021
d447b91
exposed ppTermInCtx as a Term pretty-printing operator
May 13, 2019
13448b4
Merge pull request #167 from GaloisInc/ppTermInCtx
Mar 9, 2021
178c2fc
fixed a bug in ctxReduceRecursor, where recursive arguments with func…
Dec 17, 2019
579f38e
Merge pull request #168 from GaloisInc/ctxReduceRecursor
Mar 9, 2021
48012d3
bug fix: when computing the types of the eliminator functions for rec…
Dec 30, 2019
f82bc50
Merge pull request #169 from GaloisInc/scRecursorElimTypes
Mar 9, 2021
2b87fae
bug fix: added a check that the types of constructors satisfy the pro…
Feb 23, 2021
95c82bf
fix bad multi-line string literals in universe errors
m-yac Feb 24, 2021
a97a81b
Merge pull request #172 from GaloisInc/univInconsistency
Mar 9, 2021
0ae6a0e
Add `arrowOpenTerm` to OpenTerm module.
Mar 10, 2021
a11f5d7
Add OpenTerm operations for making string literals and the string type.
Mar 10, 2021
c65d73e
Merge pull request #177 from GaloisInc/OpenTerm
Mar 10, 2021
a704552
add scTypeCheckComplete, scCheckSubtype
m-yac Jul 16, 2020
cc63b98
Merge pull request #178 from GaloisInc/scTypeCheckComplete
Mar 10, 2021
d3cc3e4
Remove the dodgy `eq` saw-core primitive.
robdockins Mar 5, 2021
fc9a61c
Compute first-order types in what I hope is a more
robdockins Mar 10, 2021
8af945d
workflow: faster workflow + lower bound on ocaml
Ptival Mar 10, 2021
70709c1
When trying to turn propositions into rewrite rules, no longer
robdockins Mar 9, 2021
f7b6b74
Be more careful with the `toTValue` operation.
robdockins Mar 10, 2021
51685e3
Merge pull request #176 from GaloisInc/remove-eq
robdockins Mar 11, 2021
37a7159
Change the random testing code to work over `FirstOrderValues`
robdockins Mar 4, 2021
60a2dbd
Add a new `SATQuery` datatype for communicating with backends.
robdockins Mar 3, 2021
81ed362
Add a new method for RME-bitblasting SAT queries directly.
robdockins Mar 5, 2021
dec0683
Add a new bitblast function based on SATQuery to the saw-core-aig pac…
robdockins Mar 8, 2021
a39f05f
Modify `w4solve` to use the new SATQuery convention instead of the pr…
robdockins Mar 9, 2021
e87ff85
Allow the concrete evaluator to take an environment for
robdockins Mar 10, 2021
1ad5fc7
Add Haddock documentation for the new SATQuery module.
robdockins Mar 12, 2021
ead69c0
Return the types of arguments as well as their labels
robdockins Mar 12, 2021
c618a3e
Remove unused code from `evalGlobal` in `Simulator.hs`.
Mar 14, 2021
8f51eee
First stab at handling permutative rewrite rules
msaaltink Feb 25, 2021
010e34e
Test rules for permutativity when created, not when applied
msaaltink Mar 10, 2021
25f4aa7
Reimplement `SimulatorConfig` and `evalGlobal` to avoid rebuilding maps.
Mar 15, 2021
699c58d
Merge pull request #184 from GaloisInc/evalGlobal
Mar 15, 2021
1dce648
Merge pull request #181 from GaloisInc/proof-conventions
robdockins Mar 15, 2021
3ce7974
Merge pull request #173 from msaaltink/permutative-rewriting
msaaltink Mar 20, 2021
88e51ea
Merge pull request #180 from GaloisInc/vr/update-workflow
Ptival Mar 20, 2021
9f0af8c
fix Cryptol primitives module name in translation (#187)
Ptival Mar 30, 2021
c85a422
saw-core-coq: add preamble suffix to configuration (#192)
Ptival Mar 30, 2021
aaf70c9
cryptol-saw-core: Adapt to PLiteralLessThan in cryptol
RyanGlScott Mar 17, 2021
2a4b85f
Whitespace-related alignment only
RyanGlScott Mar 17, 2021
f047afb
Extend `proveProp` with instance rules for `LiteralLessThan`.
Apr 1, 2021
eb9b4ef
Extend cryptol-saw-core tests to cover `LiteralLessThan` instance rules.
Apr 1, 2021
78a08fe
Update `normalizeProp` to also normalize `LiteralLessThan` constraints.
Apr 1, 2021
fa4e7c2
Fix slightly too-specific instance rule for `LiteralLessThan [n]`.
Apr 1, 2021
cdd124f
Fix instance rules in comments.
Apr 1, 2021
f9f1f92
Add stub Float instance for Literal/LiteralLessThan.
Apr 1, 2021
c6e8496
Merge pull request #188 from GaloisInc/PLiteralLessThan
RyanGlScott Apr 2, 2021
fc1d60f
wip-heapster changes to Prelude to fix saw-core-coq's `make` (#179)
m-yac Apr 5, 2021
ea914a9
Update saw-core-coq-check-coq-files.yml (#195)
Ptival Apr 6, 2021
7480704
Remove obsolete code
robdockins Mar 17, 2021
824e380
Fix corner case in `cryptolTypeOfFirstOrderType`
robdockins Mar 17, 2021
5ccd0f5
Communicate counterexamples values via `ExtCns` instead of `String`.
robdockins Mar 17, 2021
c6e16b8
Put more things in `Prop`.
robdockins Mar 18, 2021
6e32c65
Merge pull request #190 from GaloisInc/proof-conventions2
robdockins Apr 13, 2021
e4c5954
Do the right thing when encountering 0 width bitvectors in the What4 …
robdockins Apr 6, 2021
bfa8f5a
Merge pull request #196 from GaloisInc/what4-zerobv
robdockins Apr 19, 2021
4f93afc
saw-core-coq: clean _CoqProject file (#194)
Ptival Apr 19, 2021
38a00f1
expose some helper functions from Simulator.What4
spernsteiner Dec 10, 2020
12a8f95
Merge pull request #203 from GaloisInc/sp/crux-mir-comp
spernsteiner Apr 21, 2021
e751784
Remove conflicting files to prepare for merge into saw-script repo.
Apr 26, 2021
2663841
This merge pulls the previously-separate saw-core repository into the…
Apr 26, 2021
c0f67eb
Point cabal.project at saw-core packages in this repo.
Apr 26, 2021
51f932a
Delete saw-core submodule.
Apr 26, 2021
f94479d
Remove reference to `deps/saw-core` in README.md.
Apr 26, 2021
247c349
Update "issues" URL for panic messages to point at saw-script repo.
Apr 26, 2021
bc1c631
Update paths to saw-core-coq repo listed in `saw-core-coq/README.md`.
Apr 26, 2021
042edd7
saw-core-coq: update generated files
Ptival Apr 19, 2021
647a603
saw-core-coq: fix handwritten files
Ptival Apr 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/saw-core-coq-check-coq-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Type-check handwritten and generated Coq files
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
branches: [master]

jobs:
build:
strategy:
fail-fast: false
matrix:
# coq-bits does not support coq >= 8.13 yet
coq: [8.12.2, 8.11.2, 8.10.2]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
name: saw-core-coq - ${{ matrix.os }} - coq-${{ matrix.coq }}
env:
COQ_VERSION: ${{ matrix.coq }}
# coq-bits claims to support < 4.10 only
OCAML_VERSION: 4.09.1
COQBITS_VERSION: 1.0.0
steps:

- uses: actions/checkout@v2

- name: Cache ~/.opam
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-${{ env.OCAML_VERSION }}-${{ env.COQ_VERSION }}-${{ env.COQBITS_VERSION }}

# NOTE: this action is marked as experimental by their author, but it is
# much faster than avsm@setup-ocaml@v1. However, if this one ever becomes
# problematic, it should suffice to switch back to that version.
- name: Set up ocaml and opam
uses: actions-ml/setup-ocaml@df8c831c6c1e49804621d6e09c4ab9235da31fb5
with:
ocaml-version: ${{ env.OCAML_VERSION }}

- name: Install coq
shell: bash
run: |
opam pin add coq ${{ env.COQ_VERSION }}
opam install --unlock-base -y coq

- name: Install coq-bits
shell: bash
run: |
opam repo add coq-released https://coq.inria.fr/opam/released
opam install --unlock-base -y "coq-bits=$COQBITS_VERSION"

- name: Build saw-core-coq/coq
shell: bash
working-directory: saw-core-coq/coq
run: |
eval $(opam env)
coq_makefile -f _CoqProject -o Makefile.coq
make -j2
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
[submodule "deps/parameterized-utils"]
path = deps/parameterized-utils
url = https://github.com/GaloisInc/parameterized-utils.git
[submodule "deps/saw-core"]
path = deps/saw-core
url = https://github.com/GaloisInc/saw-core.git
[submodule "deps/flexdis86"]
path = deps/flexdis86
url = https://github.com/GaloisInc/flexdis86.git
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ downloaded dependencies include:
* `deps/abcBridge/`: [Haskell bindings for ABC](https://github.com/GaloisInc/abcBridge)
* `deps/crucible/`: [Crucible symbolic execution engine](https://github.com/GaloisInc/crucible)
* `deps/cryptol/`: [Cryptol](https://github.com/GaloisInc/cryptol)
* `deps/saw-core/`: [SAWCore intermediate language](https://github.com/GaloisInc/saw-core), used by CSS, JSS, and SAWScript

## For SAW developers

Expand Down
14 changes: 7 additions & 7 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ packages:
saw-script.cabal
saw-remote-api
crux-mir-comp
cryptol-saw-core
rme
saw-core
saw-core-aig
saw-core-sbv
saw-core-what4
saw-core-coq
deps/llvm-pretty
deps/llvm-pretty-bc-parser
deps/jvm-parser
deps/aig
deps/abcBridge
deps/cryptol
deps/saw-core/cryptol-saw-core
deps/saw-core/rme
deps/saw-core/saw-core
deps/saw-core/saw-core-aig
deps/saw-core/saw-core-sbv
deps/saw-core/saw-core-what4
deps/saw-core/saw-core-coq
deps/what4/what4
deps/crucible/crucible
deps/crucible/crucible-jvm
Expand Down
30 changes: 30 additions & 0 deletions cryptol-saw-core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2014, Galois, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the names of the authors nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions cryptol-saw-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This repository contains the code for the Cryptol Symbolic Simulator
(CSS). It is currently used primarily as a library from SAWScript, but
also produces a stand-alone executable, `css`. This executable has
only limited functionality: it can translate a single Cryptol function
to an And-Inverter Graph (AIG).
2 changes: 2 additions & 0 deletions cryptol-saw-core/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
94 changes: 94 additions & 0 deletions cryptol-saw-core/cryptol-saw-core.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Name: cryptol-saw-core
Version: 0.1
Author: Galois, Inc.
License: BSD3
License-file: LICENSE
Maintainer: [email protected]
Copyright: (c) 2014 Galois Inc.
Build-type: Simple
cabal-version: >= 1.10
Category: Formal Methods
Synopsis: Representing Cryptol in SAWCore
Description:
Translate Cryptol syntax into SAWCore terms, which can then
be analysed by various backend proof systems.

extra-source-files:
saw/Cryptol.sawcore

flag build-css
description: Build the css executable
default: True

library
build-depends:
aig,
array,
base,
base-compat,
bytestring,
containers,
cryptol >= 2.3.0,
data-inttrie >= 0.1.4,
integer-gmp,
modern-uri,
panic,
saw-core,
saw-core-aig,
saw-core-sbv,
saw-core-what4,
what4,
sbv,
vector,
text,
executable-path,
filepath
hs-source-dirs: src
exposed-modules:
Verifier.SAW.Cryptol
Verifier.SAW.Cryptol.Panic
Verifier.SAW.Cryptol.Prelude
Verifier.SAW.Cryptol.Simpset
Verifier.SAW.CryptolEnv
Verifier.SAW.TypedTerm
GHC-options: -Wall -Werror

executable css
if !flag(build-css)
buildable: False

other-modules:
Paths_cryptol_saw_core

build-depends:
array,
abcBridge,
base,
bytestring,
containers,
cryptol,
saw-core,
saw-core-aig,
text,
cryptol-saw-core

hs-source-dirs : css
main-is : Main.hs
GHC-options: -Wall -O2 -rtsopts -pgmlc++
extra-libraries: stdc++

test-suite cryptol-saw-core-tc-test
type: exitcode-stdio-1.0
default-language: Haskell2010

hs-source-dirs: test
main-is: CryptolVerifierTC.hs

build-depends:
base,
bytestring,
containers,
cryptol,
cryptol-saw-core,
heredoc >= 0.2,
saw-core
145 changes: 145 additions & 0 deletions cryptol-saw-core/css/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{-# LANGUAGE RankNTypes #-}

module Main where

import System.Environment( getArgs )
import System.Exit( exitFailure )
import System.Console.GetOpt
import System.IO
import qualified Data.ByteString as BS
import Data.Text ( pack )
import Data.Version

import qualified Cryptol.Eval as E
import qualified Cryptol.TypeCheck.AST as T
import qualified Cryptol.ModuleSystem as CM
import qualified Cryptol.ModuleSystem.Env as CME
import qualified Cryptol.Parser as P
import qualified Cryptol.TypeCheck.Solver.SMT as SMT
import Cryptol.Utils.PP
import Cryptol.Utils.Logger (quietLogger)

import qualified Verifier.SAW.Cryptol as C
import Verifier.SAW.SharedTerm
import qualified Verifier.SAW.Cryptol.Prelude as C
import Verifier.SAW.CryptolEnv (schemaNoUser)


import qualified Data.ABC as ABC
import qualified Verifier.SAW.Simulator.BitBlast as BBSim

import qualified Paths_cryptol_saw_core as Paths

data CSS = CSS
{ output :: FilePath
, cssMode :: CmdMode
} deriving (Show)

data CmdMode
= NormalMode
| HelpMode
| VersionMode
deriving (Show, Eq)

emptyCSS :: CSS
emptyCSS =
CSS
{ output = ""
, cssMode = NormalMode
}

options :: [OptDescr (CSS -> CSS)]
options =
[ Option ['o'] ["output"]
(ReqArg (\x css -> css{ output = x }) "FILE")
"output file"
, Option ['h'] ["help"]
(NoArg (\css -> css{ cssMode = HelpMode }))
"display help"
, Option ['v'] ["version"]
(NoArg (\css -> css{ cssMode = VersionMode }))
"version"
]

version_string :: String
version_string = unlines
[ "Cryptol Symbolic Simulator (css) version "++showVersion Paths.version
, "Copyright 2014 Galois, Inc. All rights reserved."
]

header :: String
header = "css [options] <input module> <function to simulate>"

main :: IO ()
main = do
args <- getArgs
case getOpt RequireOrder options args of
(flags,optArgs,[]) -> cssMain (foldr ($) emptyCSS flags) optArgs

(_,_,errs) -> do
hPutStr stderr (concat errs ++ usageInfo header options)
exitFailure

defaultEvalOpts :: E.EvalOpts
defaultEvalOpts = E.EvalOpts quietLogger E.defaultPPOpts

cssMain :: CSS -> [String] -> IO ()
cssMain css [inputModule,name] | cssMode css == NormalMode = do
let out = if null (output css)
then name++".aig"
else (output css)

modEnv <- CM.initialModuleEnv
let minp = CM.ModuleInput True (pure defaultEvalOpts) BS.readFile modEnv
(e,warn) <-
SMT.withSolver (CME.meSolverConfig modEnv) $ \s ->
CM.loadModuleByPath inputModule (minp s)
mapM_ (print . pp) warn
case e of
Left msg -> print msg >> exitFailure
Right (_,menv) -> processModule menv out name

cssMain css _ | cssMode css == VersionMode = do
hPutStr stdout version_string

cssMain css _ | cssMode css == HelpMode = do
hPutStr stdout (usageInfo header options)

cssMain _ _ = do
hPutStr stdout (usageInfo header options)
exitFailure


processModule :: CM.ModuleEnv -> FilePath -> String -> IO ()
processModule menv fout funcName = do
sc <- mkSharedContext
C.scLoadPreludeModule sc
C.scLoadCryptolModule sc
tm <- extractCryptol sc menv funcName
writeAIG sc fout tm

writeAIG :: SharedContext -> FilePath -> Term -> IO ()
writeAIG sc f t = do
BBSim.withBitBlastedTerm ABC.giaNetwork sc mempty t $ \be ls -> do
ABC.writeAiger f (ABC.Network be (ABC.bvToList ls))

extractCryptol :: SharedContext -> CM.ModuleEnv -> String -> IO Term
extractCryptol sc modEnv input = do
let declGroups = concatMap T.mDecls (CME.loadedModules modEnv)
env <- C.importDeclGroups sc C.emptyEnv declGroups
pexpr <-
case P.parseExpr (pack input) of
Left err -> fail (show (P.ppError err))
Right x -> return x
let minp = CM.ModuleInput True (pure defaultEvalOpts) BS.readFile modEnv
(exprResult, exprWarnings) <-
SMT.withSolver (CME.meSolverConfig modEnv) $ \s ->
CM.checkExpr pexpr (minp s)
mapM_ (print . pp) exprWarnings
((_, expr, schema), _modEnv') <-
case exprResult of
Left err -> fail (show (pp err))
Right x -> return x
putStrLn $ "Extracting expression of type " ++ show (pp (schemaNoUser schema))
C.importExpr sc env expr

Loading