-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from leanprover/ConcentratedBound
New package for VMC
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ Authors: Jean-Baptiste Tristan | |
-/ | ||
|
||
import SampCert.Extraction | ||
import SampCert.Extractor.Print | ||
|
||
#print_dafny_exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/- | ||
Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Jean-Baptiste Tristan | ||
-/ | ||
|
||
import Lean | ||
import SampCert.Extractor.Extension | ||
|
||
open System IO.FS | ||
|
||
namespace Lean.ToDafny | ||
|
||
def destination : String := "../src/DafnyVMCTrait.dfy" | ||
|
||
def writeLn (ln : String) : IO Unit := do | ||
let h ← Handle.mk destination Mode.append | ||
h.putStr "\n" | ||
h.putStr ln | ||
h.putStr "\n" | ||
|
||
elab "#print_vmc_exports" : command => do | ||
writeFile destination "" | ||
writeLn "module DafnyVMCTrait {" | ||
writeLn " import UniformPowerOfTwo" | ||
writeLn " import FisherYates" | ||
writeLn " import opened Pos" | ||
writeLn " import Uniform" | ||
|
||
writeLn " trait {:termination false} RandomTrait extends UniformPowerOfTwo.Interface.Trait, FisherYates.Implementation.Trait, Uniform.Interface.Trait {\n" | ||
|
||
let { decls, .. } := extension.getState (← getEnv) | ||
for decl in decls.reverse do | ||
--IO.println decl | ||
let h ← Handle.mk destination Mode.append | ||
h.putStr decl | ||
writeLn "}" | ||
writeLn "}" | ||
|
||
end Lean.ToDafny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/- | ||
Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Jean-Baptiste Tristan | ||
-/ | ||
|
||
import SampCert.Samplers.Uniform.Basic | ||
import SampCert.Samplers.Bernoulli.Basic | ||
import SampCert.Samplers.BernoulliNegativeExponential.Basic | ||
import SampCert.Samplers.Laplace.Basic | ||
import SampCert.Samplers.Gaussian.Basic | ||
import SampCert.DiffPrivacy.ConcentratedBound | ||
import SampCert.Extraction | ||
import SampCert.Extractor.VMC | ||
|
||
#print_vmc_exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ require mathlib from git | |
lean_lib «SampCert» where | ||
|
||
lean_lib «FastExtract» where | ||
|
||
lean_lib «VMC» where |