Comments (3)
Q: Why not Import
instead of Load
such a file?
A: There are settings (such as eg Printing Width
, reserved notations) which follow Require
(as opposed to other settings which follow Require Import
), and in order to make them not follow anything, you can prefix them with Local
, but then these settings can't be put into a shared file and pulled into the program logic proof files via Import
, so we'll have to use Load
, which "inlines" the loaded file.
from bedrock2.
Turns out Load
isn't that easy either because paths
130 andres-erbsen@andres-erbsen-sifive /tmp % find b :(
b
b/a.glob
b/.a.aux
b/a.v
b/b.v
andres-erbsen@andres-erbsen-sifive /tmp % coqc b/a.v
File "./b/a.v", line 1, characters 0-11:
Error: Can't find file b.v on loadpath
could we somehow make things so that for each file, emacs and makefile call coq from the same working directory?
coq/coq#8649 coq/coq#8649 coq/coq#4953
from bedrock2.
emacs changes the working directory to the directory of the file of the current buffer before invoking coqtop
, and while we might be able to change that behavior using some emacs hacks, I'd rather not have a solution which depends on the current working directory.
Coq's Load
command calls find_file_in_path
in lib/system.ml
, which distinguishes between "implicit paths" and "non implicit paths" (according to what Filename.is_implicit returns).
If you put a "non implicit path" (i.e. one which starts with .
, ..
, or the root /
) after the Load
, Coq will use the file system's behavior to look for the file, and this depends on the current working directory of the coq process, which we want to avoid.
On the other hand, if you put an "implicit path" after the Load
, Coq will loop through all paths in the loadpath, append that implicit path to each of them, and pick the first file which exists, emitting a warning if several exist.
So the following works both for compliation from the command line, and within emacs:
[sam@samsdell tmp]$ find src
src
src/b.v
src/a.vo
src/mysubdir
src/mysubdir/c.v
src/a.glob
src/a.v~
src/a.v
src/.a.aux
[sam@samsdell tmp]$ cat src/b.v
Definition foo: nat := 5.
[sam@samsdell tmp]$ cat src/mysubdir/c.v
Definition bar: nat := 6.
[sam@samsdell tmp]$ cat src/b.v
Definition foo: nat := 5.
[sam@samsdell tmp]$ cat src/a.v
Load "b.v".
Load "mysubdir/c.v".
Print foo.
Print bar.
[sam@samsdell tmp]$ coqc -Q ./src b ./src/a.v
foo = 5
: nat
bar = 6
: nat
[sam@samsdell tmp]$ cat _CoqProject
-Q ./src b
[sam@samsdell tmp]$ emacs ./src/a.v
from bedrock2.
Related Issues (20)
- Move MMIO.v HOT 3
- stackloop: `main` should return `int`, not `void` HOT 1
- Using multiple return values HOT 2
- Why does bedrock2 use `Load`? HOT 2
- Please create a tag for Coq 8.16 in Coq Platform 2022.09 HOT 6
- bedrock2 fails with a syntax error on Windows HOT 9
- bedrock2 lightbulb example is incompatible with native_compute HOT 5
- Less Memory-Hungry, More Principled Solution for Decidable Side-Conditions HOT 2
- Failing in coq CI HOT 1
- `make` should not run `coq` and `cc` when there's nothing to be done
- Update tested is failing with rate limits HOT 2
- Bedrock2 is broken on Coq's CI HOT 1
- Please pick the version you prefer for Coq 8.17 in Coq Platform 2023.03 HOT 2
- Please pick the version you prefer for Coq 8.17 in Coq Platform 2023.03 HOT 2
- design: outputting bitwidth-generic code? HOT 7
- design: core functionality of RecordPredicates? HOT 4
- Unbound value Int.land HOT 2
- Please pick the version you prefer for Coq 8.18 in Coq Platform 2023.10 [coq-bedrock2] HOT 2
- Please pick the version you prefer for Coq 8.18 in Coq Platform 2023.10 [coq-bedrock2-compiler] HOT 2
- install target is unusable when sudo doesn't have access to coqc HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bedrock2.