Types and Programming Languages in Rocq (formerly Coq)
- Rocq Prover 9.0.0
- OCaml 4.14.0 or later (installed with Rocq)
opam switch create TAPL-rocq --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda
opam switch TAPL-rocq
opam repo add rocq-released https://rocq-prover.org/opam/released
opam pin add rocq-prover 9.0.0Recommand to use VsRocq Extension. (Please use rocq-language-server 2.3.3 or later)
Ensure Rocq environment is loaded:
eval $(opam env) # Very Important!!
rocq --version # Verify installationThis project uses distributed _CoqProject management - each module maintains its own configuration.
# Build all modules (Props → Tactics → src → plf)
./run_make.sh
# Clean all modules
./clean_all.shTAPL-rocq/
├── Props/ # Basic relation properties
│ └── _CoqProject (-Q . TAPL.Props)
├── Tactics/ # Proof tactics library
│ └── _CoqProject (-Q . TAPL.Tactics)
├── src/ # Core TAPL implementations
│ └── _CoqProject (-Q . TAPL, with deps to Props/Tactics/plf)
└── plf/ # Programming Language Foundations
└── _CoqProject (-Q . PLF)
Build a specific module:
cd src # or Props, Tactics, plf
rocq makefile -f _CoqProject -o Makefile
make -j$(nproc)See BUILD.md for detailed build instructions.
Step 1: Generate CoqMakefile (legacy, not used in distributed mode)
rocq makefile -f _CoqProject -o CoqMakefileStep 2: Build (legacy)
make # Build all files
make all # Same as aboveStep 3: Clean
make clean # Remove compiled files
make cleanall # Remove all generated files including CoqMakefileStep 4: Compile Single File
make <file>.vo # e.g., make plf/Maps.vo
# or
rocq compile -R . TAPL <file>.vTAPL-rocq/
├── _CoqProject # Project configuration
├── Makefile # Build system wrapper
├── CoqMakefile.local # Custom build extensions
├── run_make.sh # Quick build script
├── src/ # Source files
│ ├── UntypedArithExpr.v
│ └── ArithExpr.v
├── plf/ # Programming Language Foundations
│ └── Maps.v
├── Props/ # Properties
│ └── RelationProp.v
└── Tactics/ # Custom tactics
└── Tactics.v
Ensure VsRocq extension is installed in VS Code
Option 1: Use the launch script (Recommended)
./launch_vscode.shOption 2: Manual launch
eval $(opam env)
code .If .v files are not recognized or highlighted:
-
Run the debug script:
./debug_vsrocq.sh
-
Check VS Code Output:
- Open:
View→Output - Select:
VsRocqfrom dropdown - Look for error messages
- Open:
-
Common Issues:
- ❌ VsRocq not starting: Restart VS Code after running
eval $(opam env) - ❌ Files not recognized: Check
.vscode/settings.jsonhas correctvsrocq.path - ❌ No syntax highlighting: Ensure
files.associationsincludes"*.v": "rocq"
- ❌ VsRocq not starting: Restart VS Code after running
-
Enable verbose logging:
- Already enabled in
.vscode/settings.json - Check Output panel for detailed logs
- Already enabled in
-
Verify configuration:
# Check vsrocqtop is accessible which vsrocqtop # Test manually vsrocqtop --version
.vscode/settings.json- VsRocq configuration.vscode/tasks.json- Build tasks.vscode/extensions.json- Recommended extensions
- This project uses Rocq 9.0.0 (the rebranded version of Coq)
- The
-Rflag in_CoqProjectallows flexible module loading - All files use the
TAPLlogical root namespace - VS Code must be launched with opam environment loaded for VsRocq to work
This project is licensed under the MIT License - see the LICENSE file for details.
This project contains code from Software Foundations, specifically Volume 2 (Programming Language Foundations), located in the plf/ directory.
- The content in the
plf/directory is Copyright (c) 2025 University of Pennsylvania and/or original authors. - It is licensed under the MIT License (or applicable license as specified in
plf/LICENSE). - Code in
plf/serves as a foundation/reference for this project.