Skip to content

Commit

Permalink
Fix documentation and comments (#167)
Browse files Browse the repository at this point in the history
By submitting this pull request, I confirm that my contribution is made
under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).
  • Loading branch information
stefan-aws authored Mar 18, 2024
1 parent be33d9d commit 38e583e
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion audit.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
src/DafnyVMC.dfy(35,27): UniformSample32: Declaration has `{:verify false}` attribute.
src/Distributions/Uniform/Model.dfy(19,26): Sample: Declaration has explicit `{:axiom}` attribute.
src/Distributions/Uniform/Model.dfy(18,26): Sample: Declaration has explicit `{:axiom}` attribute.
src/ProbabilisticProgramming/RandomSource.dfy(50,17): ProbIsProbabilityMeasure: Declaration has explicit `{:axiom}` attribute.
2 changes: 1 addition & 1 deletion docs/dafny/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<br>
<a href="dafny-doc/index.html">Dafny documentation</a>
<br>
<a href="ExamplesRandom.dfy">Example using the foundational uniform sampler</a>
<a href="ExamplesRandom.dfy">Examples of Sampling</a>
4 changes: 3 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<br>
<a href="dafny/index.html">Using Dafny-VMC from Dafny</a>
<br>
<a href="java/index.html">Using Dafny-VMC from Java </a>
<a href="java/index.html">Using Dafny-VMC from Java</a>
<br>
<a href="py/index.html">Using Dafny-VMC from Python</a>
6 changes: 4 additions & 2 deletions docs/java/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Using the Dafny-VMC library in a Java application.
<br>
<a href="java-doc/index.html">Java documentation</a>
<a href="java-doc/DafnyVMC/package-summary.html">Java documentation</a>
<br>
<a href="BuildTest.java">Example</a>
<a href="TestSamplers.java">Examples of Sampling</a>
<br>
<a href="TestShuffling.java">Examples of Shuffling</a>
7 changes: 7 additions & 0 deletions docs/py/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Using the Dafny-VMC library in a Python application.
<br>
<a href="py-doc/DafnyVMC.html">Python documentation</a>
<br>
<a href="TestSamplers.py">Examples of Sampling</a>
<br>
<a href="TestShuffling.py">Examples of Shuffling</a>
15 changes: 12 additions & 3 deletions scripts/gendoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ echo Generating Dafny documentation...
$DAFNY doc dfyconfig.toml --output docs/dafny/dafny-doc/

echo Generating Java documentation...
$DAFNY translate java src/Dafny-VMC.dfy --no-verify
cp $DAFNYSOURCE/Source/DafnyRuntime/DafnyRuntimeJava/src/main/java/dafny/*.java src/Dafny-VMC-java/dafny/
javadoc -d docs/java/java-doc/ -sourcepath src/Dafny-VMC-java -package DafnyVMC
dafny translate java src/interop/java/Full/CustomRandom.java src/interop/java/Full/Random.java dfyconfig.toml -o src/DafnyVMC --no-verify --include-runtime
mkdir src/DafnyVMC-java/DafnyVMC
cp src/interop/java/Full/CustomRandom.java src/DafnyVMC-java/DafnyVMC
cp src/interop/java/Full/Random.java src/DafnyVMC-java/DafnyVMC
find src/DafnyVMC-java/ -type f -name "*.java" | xargs javadoc -d docs/java/java-doc/

echo Generating Python documentation...
export TARGET_LANG=py
bash scripts/build.sh
PYTHONPATH=.:build/py/DafnyVMC-py pydoc3 -w build/py/DafnyVMC-py/DafnyVMC.py
mkdir docs/py/py-doc
mv DafnyVMC.html docs/py/py-doc
1 change: 0 additions & 1 deletion src/Distributions/Uniform/Model.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module Uniform.Model {
Definitions
************/

// Definition 49
ghost function {:axiom} Sample(n: nat): (h: Monad.Hurd<nat>)
requires n > 0
ensures Independence.IsIndepFunction(h)
Expand Down
5 changes: 0 additions & 5 deletions src/Math/Analysis/Reals.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
* SPDX-License-Identifier: MIT
*******************************************************************************/

// Fundamental properties of the real numbers.
// * States the completeness of the reals in terms of a variation of Dedekind cuts.
// Dafny should include such an axiom, but doesn't.
// See: https://en.wikipedia.org/wiki/Completeness_of_the_real_numbers
// * Proves existence and uniqueness of infima and suprema
module Reals {
import RealArith

Expand Down
1 change: 1 addition & 0 deletions src/Math/Helper.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*******************************************************************************/

module Helper {

/************
Definitions
************/
Expand Down
3 changes: 1 addition & 2 deletions src/ProbabilisticProgramming/Monad.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ module Monad {
type Hurd<A> = Rand.Bitstream -> Result<A>

// The result of a probabilistic computation on a bitstream.
// It either consists of the computed value and the (unconsumed) rest of the bitstream or indicates nontermination.
// It differs from Hurd's definition in that the result can be nontermination, which Hurd does not model explicitly.
// It consists of the computed value and the (unconsumed) rest of the bitstream.
datatype Result<A> = Result(value: A, rest: Rand.Bitstream)
{
function Map<B>(f: A -> B): Result<B> {
Expand Down

0 comments on commit 38e583e

Please sign in to comment.