Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
322617e
Initial commit
nikswamy Dec 22, 2023
73ee92f
initial import of files from FStarLang/FStar/doc/book
nikswamy Dec 22, 2023
c399a43
mention vscode
nikswamy Dec 23, 2023
9c22e96
pulse in progress
nikswamy Dec 23, 2023
ec132c7
steel/pulse
nikswamy Dec 23, 2023
400e4a8
many small fixes, thanks to Brian Milnes
nikswamy Dec 27, 2023
a5ada54
fix some formatting
nikswamy Dec 27, 2023
726a193
typo
nikswamy Dec 27, 2023
1d61a3e
Merge remote-tracking branch 'origin/main' into pulse
nikswamy Dec 27, 2023
5a0eec8
ch2 in progress
nikswamy Dec 30, 2023
6cb6dc8
ch2 wip
nikswamy Dec 30, 2023
8ed7224
swap
nikswamy Jan 4, 2024
8fd82ac
existentials, user-defined preds, some control flow
nikswamy Jan 4, 2024
a71bb87
perm
nikswamy Jan 4, 2024
2d00580
rewriting etc.
nikswamy Jan 4, 2024
083a222
more control flow
nikswamy Jan 4, 2024
e4d84ad
loops
nikswamy Jan 5, 2024
88ac887
chapter on mutable arrays
aseemr Jan 5, 2024
b4ef084
some light edits in array chapter
nikswamy Jan 5, 2024
35cfbc5
recursion, plus some tweaks
nikswamy Jan 6, 2024
713a679
higher order functions and some linked list, starting on @==>
nikswamy Jan 9, 2024
febf3c6
higher order, implication and forall
nikswamy Jan 9, 2024
11cc829
trades, linked list
nikswamy Jan 10, 2024
8ac520a
extraction
aseemr Jan 10, 2024
a1c55cb
merging
aseemr Jan 10, 2024
09e2af5
more linked list
nikswamy Jan 10, 2024
1b1952c
tweaks
nikswamy Jan 10, 2024
fac33bb
atomics & invariants
nikswamy Jan 11, 2024
06d9bd6
spin lock;
nikswamy Jan 11, 2024
288ed53
more on extraction
aseemr Jan 11, 2024
454dd29
more on parallel increment
nikswamy Jan 13, 2024
fbdf83c
parallel increment with invariants
nikswamy Jan 13, 2024
8e31633
typos
nikswamy Jan 14, 2024
e789348
spellcheck
nikswamy Jan 14, 2024
1116eed
one more spinlock exercise
nikswamy Jan 14, 2024
a736798
typos
mtzguido Jan 14, 2024
9aa5920
pulse: getting started
mtzguido Jan 14, 2024
db60a16
space
nikswamy Jan 14, 2024
a7abdf9
images
mtzguido Jan 14, 2024
b2ed0ec
a bit about the release
nikswamy Jan 14, 2024
05d4620
fix link
nikswamy Jan 15, 2024
b8e0909
some updates to latest Pulse
nikswamy May 30, 2024
5b74fd6
s/full_perm/1.0R/g
nikswamy May 30, 2024
dc24c8f
revising atomic and invariants, boxable predicates
nikswamy May 31, 2024
2b014f0
more on atomics and invariants
nikswamy May 31, 2024
a3f2835
update chapters on spin lock, parallel increment, and extraction
nikswamy Jun 2, 2024
1e57867
fix up some docs to reflect improvements in the Pulse checker
nikswamy Jun 26, 2024
ae285fb
fix grammar
rawburt Jul 1, 2024
3af94d7
Merge pull request #1 from rawburt/patch-1
mtzguido Jul 1, 2024
98db633
fix grammar
rawburt Jul 5, 2024
5c7c90f
Merge pull request #2 from rawburt/patch-2
nikswamy Jul 5, 2024
5de5fe4
rewrite www.fstar-lang.org to fstar-lang.org
nikswamy Jul 6, 2024
5547607
Merge branch 'main' of github.com:FStarLang/PoP-in-FStar
nikswamy Jul 6, 2024
12d8396
Update part1_termination.rst
jestinepaul Aug 7, 2024
262393c
Merge pull request #3 from jestinepaul/patch-1
mtzguido Aug 7, 2024
1577ab0
Remove pull.
gebner Jan 8, 2025
adc0504
Minor fix (Obviously, F# was intended here)
wmeyer Jan 12, 2025
1bf3684
Merge pull request #5 from wmeyer/patch-1
mtzguido Jan 12, 2025
e950bb1
update references to code snippets, migrated to #lang-pulse
nikswamy Apr 6, 2025
1074c37
s/vprop/slprop/g
nikswamy Apr 6, 2025
cab0333
revise atomics & invariants chapter to describe impredicativity and l…
nikswamy Apr 7, 2025
8db8bbc
update spin lock chapter to not mention boxable predicates
nikswamy Apr 7, 2025
80e9668
Merge pull request #4 from FStarLang/gebner_rm_pull
nikswamy Apr 7, 2025
5e5afde
Fix a few typos
TJNhxMZHmqGytuWT May 21, 2025
11197d2
Merge pull request #6 from TJNhxMZHmqGytuWT/patch-1
nikswamy May 21, 2025
fe15562
Part3 chapter: Fun with typeclasses
nikswamy May 24, 2025
718cc0a
Merge remote-tracking branch 'origin/main'
nikswamy May 24, 2025
6187fdd
Fixed typo ['i + i' --> 'i + 1']
utgheith Aug 18, 2025
0582898
Merge pull request #7 from utgheith/patch-1
mtzguido Aug 18, 2025
966eca3
Update after FStarLang/FStar#3753
mtzguido Feb 14, 2025
3a8ac3f
tweak a la carte
nikswamy Aug 18, 2025
cd175f8
no need to explicitly sequence pulse commands
nikswamy Aug 18, 2025
8b838ce
Merge branch 'main' of github.com:FStarLang/PoP-in-FStar
nikswamy Aug 18, 2025
103ab43
pulse: bring in missing snippet
mtzguido Aug 18, 2025
31109fa
Update Pulse extraction commands, needs --cmi
mtzguido Nov 20, 2025
cd29748
Pulse: remove section about needing to let-bind, this is gone
mtzguido Nov 20, 2025
a32d807
Add 'doc/book/PoP-in-FStar/' from commit 'cd2974840ca7edc4e9c5ce9dac9…
nikswamy Apr 2, 2026
d0e421a
Adjust PoP-in-FStar Makefile for new location in FStar repo
nikswamy Apr 2, 2026
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
201 changes: 201 additions & 0 deletions doc/book/PoP-in-FStar/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
33 changes: 33 additions & 0 deletions doc/book/PoP-in-FStar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# PoP-in-FStar
The Proof-oriented Programming in F* Book


# Build

To set up an environment to build the book, you will need python3, sphinx, and the sphinx_rtd_theme.

Once you have python3, on Ubuntu-24, install using:

* sudo apt install python3-sphinx
* sudo apt install python3-sphinx_rtd_theme

Then, see book/Makefile:

- set FSTAR_HOME, if the default is not correct
- likewise, set PULSE_HOME

Then,

* make -C book prep #to copy source files from F* and Pulse into the book build folders
* make -C book html
* make -C book pdf

You should have book/_build/html/index.html


# Deploy


Set FSTARLANG_ORG_ROOT in book/Makefile

* make deploy
4 changes: 4 additions & 0 deletions doc/book/PoP-in-FStar/book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
code
_build
*~
38 changes: 38 additions & 0 deletions doc/book/PoP-in-FStar/book/IncrPair.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module IncrPair
open Steel.Memory
open Steel.Effect
open Steel.Reference
open Steel.FractionalPermission
open Steel.Effect.Atomic
open FStar.Ghost
assume
val pts_to (#a:Type u#0)
(r:ref a)
([@@@ smt_fallback] v:a)
: slprop u#1

assume
val read (#a:Type) (#v:Ghost.erased a) (r:ref a)
: Steel a (pts_to r v) (fun x -> pts_to r x)
(requires fun _ -> True)
(ensures fun _ x _ -> x == Ghost.reveal v)

assume
val write (#a:Type0) (#v:Ghost.erased a) (r:ref a) (x:a)
: SteelT unit (pts_to r v)
(fun _ -> pts_to r x)

//
let incr (#v:Ghost.erased int) (r:ref int) ()
: SteelT unit (pts_to r v)
(fun _ -> pts_to r (v + 1))
= let x = read r in
write #_ #(Ghost.hide x) r (x + 1);
change_slprop (pts_to r (x + 1)) (pts_to r (v + 1)) (fun _ -> ())

//SNIPPET_START: par_incr
let par_incr (#v0 #v1:erased int) (r0 r1:ref int)
: SteelT _ (pts_to r0 v0 `star` pts_to r1 v1)
(fun _ -> pts_to r0 (v0 + 1) `star` pts_to r1 (v1 + 1))
= par (incr r0) (incr r1)
//SNIPPET_END: par_incr
56 changes: 56 additions & 0 deletions doc/book/PoP-in-FStar/book/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Minimal makefile for Sphinx documentation
#

# This book lives at doc/book/PoP-in-FStar/book/ within the FStar repo
export FSTAR_HOME?=$(realpath ../../../..)
export PULSE_HOME?=$(FSTAR_HOME)/pulse

FSTARLANG_ORG_ROOT?=www

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = FStarBook
SOURCEDIR = .
BUILDDIR = _build

prep:
mkdir -p code
ln -sfn $(realpath $(FSTAR_HOME)/doc/book/code)/* code/
ln -sfn $(realpath $(PULSE_HOME)/share/pulse/examples/by-example) code/pulse


html: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
find _build -name "*.html" | xargs sed -i 's/_static/static/g'
rm -rf _build/html/static
mv _build/html/_static _build/html/static

LATEXFILE=proof-orientedprogramminginf.tex

pdf:
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
sed -i -e 's|\\chapter|\\part|g' $(BUILDDIR)/latex/$(LATEXFILE)
sed -i -e 's|\\section|\\chapter|g' $(BUILDDIR)/latex/$(LATEXFILE)
sed -i -e 's|\\subsection|\\section|g' $(BUILDDIR)/latex/$(LATEXFILE)
sed -i -e 's|\\subsubsection|\\subsection|g' $(BUILDDIR)/latex/$(LATEXFILE)
sed -i -e 's|\\sphinxhref{../code/|\\sphinxhref{https://fstar-lang.org/tutorial/book/code/|g' $(BUILDDIR)/latex/$(LATEXFILE)
sed -i -e 's|\\part{Structure of this book}|\\begin{center}\\bigskip{\\Large \\textbf{Structure of this book}}\\bigskip\\end{center}|g' $(BUILDDIR)/latex/$(LATEXFILE)
$(MAKE) -C $(BUILDDIR)/latex

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

deploy:
rm -rf $(FSTARLANG_ORG_ROOT)/tutorial/book/
cp -R _build/html $(FSTARLANG_ORG_ROOT)/tutorial/book/
cp -R code $(FSTARLANG_ORG_ROOT)/tutorial/book/
cp _build/latex/proof-orientedprogramminginf.pdf $(FSTARLANG_ORG_ROOT)/tutorial/proof-oriented-programming-in-fstar.pdf

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefil
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3 changes: 3 additions & 0 deletions doc/book/PoP-in-FStar/book/MemCpy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void alloc_copy_free() {
//TODO
}
Loading
Loading