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

Implement entities database and auditor #11

Merged
merged 106 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
fc65706
git: mv Translator.dfy Translator.Common.dfy
cpitclaudel Aug 16, 2022
a9b8fe7
git: checkout Translator.dfy
cpitclaudel Aug 16, 2022
c731cd3
ast(wip): Model entities
cpitclaudel Jul 22, 2022
869befb
git: cp Translator.dfy Translator.Common.dfy
cpitclaudel Aug 16, 2022
a62208c
src: Move common parts of the translator to `Translator.Common`
cpitclaudel Aug 16, 2022
d14b6d3
ast: Refine definition of entities
cpitclaudel Aug 16, 2022
fe168ae
debug: Add a simple printer for entity hierarchies
cpitclaudel Aug 16, 2022
6f91649
ast: Improve verification performance of witnesses in Entities.dfy
cpitclaudel Aug 17, 2022
7473049
ast: Improve verification performance of Registry.Valid?()
cpitclaudel Aug 17, 2022
0c498f4
ast: Add a `Program` entity
cpitclaudel Aug 17, 2022
fe4d457
debug: Simplify traversal by leveraging well-formedness of registry
cpitclaudel Aug 17, 2022
813caba
lib: Check in sorting routine
cpitclaudel Aug 19, 2022
ebdc189
lib: Add Seq.Flatten
cpitclaudel Aug 19, 2022
928e9be
lib: Axiomatize a function version of Seq.Sort
cpitclaudel Aug 19, 2022
d43f87b
lib: Add Outcome.CombineSeq
cpitclaudel Aug 19, 2022
faab5c6
ast: Add an order on names
cpitclaudel Aug 19, 2022
8368492
ast: Add a validation function on entities
cpitclaudel Aug 19, 2022
c0743a5
ast: Separate out known attributes in entities
cpitclaudel Aug 19, 2022
d168394
ast: Make witness expressions optional
cpitclaudel Aug 19, 2022
9e544b0
ast: Add an API to retrieve the list of all names defined in the program
cpitclaudel Aug 19, 2022
860dd09
ast: Add a field to the Module entity
cpitclaudel Aug 19, 2022
1cce2e7
lib: Add `ensures` to `Seq.Flatten`
cpitclaudel Aug 24, 2022
9fb131d
ast: Rename Name.SuffixOf to Name.ExtensionOf and add Name.PrefixOf
cpitclaudel Aug 24, 2022
dc04167
ast: Use `Registry.Contains(name)` instead of `name in entities` in s…
cpitclaudel Aug 24, 2022
60429bb
ast: Define `Name.NthParent` and `Name.TruncateTo`
cpitclaudel Aug 24, 2022
75e76ac
ast: Rename `Registry.SuffixesOf` to `Registry.TransitiveMembers`
cpitclaudel Aug 24, 2022
30f28be
ast: Strengthen registry's validity criterion
cpitclaudel Aug 24, 2022
76ecbd8
ast: Prove more general lemmas about recursive traversals
cpitclaudel Aug 24, 2022
7be7075
ast: Add and prove a depth-first traversal of the entity graph
cpitclaudel Aug 24, 2022
f025b45
ast: Add a registry API to retrieve all names
cpitclaudel Aug 24, 2022
ebb4cd9
transforms: Fix typo introduced in 6945382
cpitclaudel Aug 24, 2022
f181510
lib: Make `Comparison.Valid?` and `Comparison.Total?` opaque
cpitclaudel Aug 24, 2022
0461afb
ast: Speed up verification by disabling induction
cpitclaudel Aug 24, 2022
aa73d4d
ast: Complete proof of `Registry.Validate()`
cpitclaudel Aug 24, 2022
ec356cd
; ast: Remove comment made obsolete by c5ac992
cpitclaudel Aug 24, 2022
7b5b501
ast: Complete proof of `Registry.SortedNames`
cpitclaudel Aug 25, 2022
e6475c9
ast: Finish proof of `Registry.Validate`
cpitclaudel Aug 25, 2022
950cfee
ast: Rename `Registry.Add` to `AddRoot` and implement `AddMember`
cpitclaudel Aug 25, 2022
4fb886b
interop: Add simple dictionary-to-list code
atomb Aug 24, 2022
eb98c72
ast: Add some entity translations
atomb Aug 24, 2022
bb64ebf
tools: Add initial auditor, using the entity model
atomb Aug 24, 2022
3453401
interop: Replace `DictionaryToList` with `DictUtils.Fold`
atomb Aug 25, 2022
e59d13c
ast: Remove module member name sequence
atomb Aug 25, 2022
bf15256
auditor: Rename entry point
atomb Aug 25, 2022
d8e33da
ast: Fill in most C# AST to Entity translations
atomb Aug 25, 2022
694a4f3
ast: Move entity translations into another module
atomb Aug 26, 2022
3072327
ast: Move `Translator.Entity` to `-functionSyntax:4`
atomb Aug 29, 2022
477eed1
ast: Add location to `EntityInfo`
atomb Aug 29, 2022
4466796
ast: Improve entity translation error messages
atomb Aug 29, 2022
cb85ee5
ast: Translate ensures and requires clauses
atomb Aug 29, 2022
5d9ec15
auditor: Get tool to compile
atomb Aug 29, 2022
9fa6259
build: Add missing dependency for auditor
atomb Aug 30, 2022
1ca43a1
ast: Re-add `Unsupported` expression alternative
atomb Aug 30, 2022
08a7e77
ast: Add support for predicate statements
atomb Aug 30, 2022
e610527
ast: Translate empty method and function bodies
atomb Aug 30, 2022
b7dc952
ast: Allow empty names, locations, and attributes
atomb Aug 30, 2022
ec6fa5b
ast: Allow conversion expressions
atomb Aug 30, 2022
550974e
ast: Provide `ToString` function for `ValidationError`
atomb Aug 30, 2022
3752079
auditor: Allow auditing programs that don't validate
atomb Aug 30, 2022
641c88a
ast: Add `Any_Expr` predicate
atomb Aug 30, 2022
634c675
auditor: Make entry point a method
atomb Aug 30, 2022
78ebe02
auditor: Improve detection of assumptions
atomb Aug 30, 2022
f65817f
; auditor: Remove obsolete comment
atomb Aug 31, 2022
ac575fd
ast: Add `Unsupported` type alternative
atomb Aug 31, 2022
3360e94
ast: Allow unsupported literals
atomb Aug 31, 2022
a35a1cb
ast: Begin translating type synonyms, parameters
atomb Aug 31, 2022
d67bfe9
ast: Translate programs to validated registries
atomb Sep 2, 2022
55dc6cf
lib: Move `Interleave` to the standard library
atomb Sep 2, 2022
a28e090
src: Make all Dafny code verify with latest changes
atomb Sep 2, 2022
e7ada51
auditor: Fix compilation
atomb Sep 2, 2022
6589c15
ast: Translate synonym and newtype subset types
atomb Sep 2, 2022
3c8a90d
auditor: Audit subset types lacking witnesses
atomb Sep 2, 2022
d94bc94
ast: Add children to Expr.Unsupported constructor
atomb Sep 7, 2022
0192aa3
auditor: Add tag for presence of `requires`
atomb Sep 8, 2022
7a9640f
auditor: Disable warnings on missing witness
atomb Sep 8, 2022
987a6ae
ast: Include Unsupported children in traversals
atomb Sep 9, 2022
14f9497
build: Change `dafny` variable to `DAFNY`
atomb Sep 9, 2022
cada01c
ast: Remove unnecessary import
atomb Sep 9, 2022
3203fa5
ast: Add more `Unsupported` constructors
atomb Sep 9, 2022
11bac3a
ast: Don’t translate type parameters for now
atomb Sep 9, 2022
c514461
build: Remove obsolete post-processing of C# code
atomb Sep 9, 2022
8a0e6de
ast: Minor syntactic cleanups
atomb Sep 9, 2022
4ee4767
ast: Add `EntityInfo` to `Entity.Unsupported`
atomb Sep 10, 2022
936118c
interp: Fix `Unsupported` expressions
atomb Sep 10, 2022
bbbb801
lib: Add `Option.All`
atomb Sep 10, 2022
78126ab
; auditor: Syntactic cleanups
atomb Sep 10, 2022
b4ee536
lib: Add `Option.Map`
atomb Sep 10, 2022
f71a09d
auditor: Adjust the set of tags
atomb Sep 10, 2022
efcd950
lib: Improve `Break` and `Split`
atomb Sep 10, 2022
1f3d1f7
ast: Refactor error handling in expression translation
atomb Sep 12, 2022
388e894
interop: More correct List, Dictionary treatment
atomb Sep 12, 2022
913b011
; auditor: Minor refactoring
atomb Sep 12, 2022
3f0c810
auditor: Add some support for `decreases *`
atomb Sep 12, 2022
1e16c64
ast: Properly translate module children
atomb Sep 12, 2022
999f530
ast: Improve registry validation error messages
atomb Sep 12, 2022
af643b8
transform: Whitespace only
atomb Sep 12, 2022
052bfcc
ast: Support traversing IEnumerables in AST nodes
atomb Sep 12, 2022
4b78426
auditor: Support multiple output formats
atomb Sep 13, 2022
b677d62
ast: Add BUG comment about ghost parameter
atomb Sep 13, 2022
87c51ce
ast: Refactor translation of `UnaryOpExpr`
atomb Sep 13, 2022
7583d80
src: Include some TODO comments
atomb Sep 13, 2022
b99af8c
; ast: Add two TODO comments in Entities.dfy
cpitclaudel Sep 13, 2022
b8d5091
; repl: Add a pointer to dafny-lang/dafny#2740
cpitclaudel Sep 14, 2022
bd843a1
; ast: Remove to DISCUSS markers
cpitclaudel Sep 14, 2022
8ef4afa
src: Use // syntax for docstrings and /// syntax for sections
cpitclaudel Sep 14, 2022
28299a2
; ast: Add a link in a BUG comment
cpitclaudel Sep 14, 2022
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
24 changes: 18 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,27 @@ DafnyPipeline = $(dafny_Source)/Dafny/DafnyPipeline
DafnyAST = $(dafny_Source)/Dafny/AST/DafnyAst
DafnyRuntime := $(dafny_Source)/DafnyRuntime/DafnyRuntime.cs

dafny := dotnet run --project $(DafnyDriver).csproj $(DAFNY_DOTNET_RUN_FLAGS) --
dafny_codegen := $(dafny) -spillTargetCode:3 -compile:0 -noVerify -useRuntimeLib
dafny_typecheck := $(dafny) -dafnyVerify:0
dafny_verify := $(dafny) -compile:0 -trace -verifyAllModules -showSnippets:1 -vcsCores:8
DAFNY ?= dotnet run --project $(DafnyDriver).csproj $(DAFNY_DOTNET_RUN_FLAGS) --
dafny_codegen := $(DAFNY) -spillTargetCode:3 -compile:0 -noVerify -useRuntimeLib
dafny_typecheck := $(DAFNY) -dafnyVerify:0
dafny_verify := $(DAFNY) -compile:0 -trace -verifyAllModules -showSnippets:1 -vcsCores:8

# Project files
# =============

# Subprojects
csharp := src/Backends/CSharp
repl := src/REPL
auditor := src/Tools/Auditor

# Binaries
plugin_dll := $(csharp)/bin/Debug/net6.0/CSharpCompiler.dll
repl_dll := $(repl)/bin/Release/net6.0/REPL.dll
dlls := $(plugin_dll) $(repl_dll)
auditor_dll := $(auditor)/bin/Debug/net6.0/DafnyAuditor.dll
dlls := $(plugin_dll) $(repl_dll) $(auditor_dll)

# Entry points
dfy_entry_points := $(repl)/Repl.dfy $(csharp)/Compiler.dfy
dfy_entry_points := $(repl)/Repl.dfy $(csharp)/Compiler.dfy $(auditor)/Auditor.dfy
cs_entry_points := $(dfy_entry_points:.dfy=.cs)
cs_roots := $(dir $(cs_entry_points))
cs_objs := $(cs_roots:=bin) $(cs_roots:=obj)
Expand Down Expand Up @@ -103,10 +105,18 @@ $(csharp)/Compiler.cs: $(csharp)/Compiler.dfy $(dfy_models) $(dfy_interop) $(Daf
sed -i.bak -e 's/__AUTOGEN__//g' "$@"
rm "[email protected]" # https://stackoverflow.com/questions/4247068/

$(auditor)/Auditor.cs: $(auditor)/Auditor.dfy $(dfy_models) $(dfy_interop) $(DafnyRuntime)
$(dafny_codegen) $< || true
sed -i.bak -e 's/__AUTOGEN__//g' "$@"
rm "[email protected]" # https://stackoverflow.com/questions/4247068/

# Compile the resulting C# code
$(plugin_dll): $(csharp)/Compiler.cs $(cs_interop)
dotnet build $(csharp)/CSharpCompiler.csproj

$(auditor_dll): $(auditor)/Auditor.cs $(auditor)/EntryPoint.cs $(cs_interop)
dotnet build $(auditor)/DafnyAuditor.csproj

# Run it on tests
test/%.cs: test/%.dfy $(plugin_dll) $(DafnyRuntime)
$(dafny_codegen) -plugin:$(plugin_dll) -compileTarget:cs "$<"
Expand All @@ -129,6 +139,8 @@ tests: $(cs_tests)
repl: $(repl_dll) FORCE
dotnet exec $<

auditor: $(auditor_dll) FORCE

typecheck:
$(dafny_typecheck) $(dfy_entry_points)

Expand Down
Loading