how to compile lists.v in coq? - coq

I'm using the assistant proof COQ, my first question would be about the Induction.v file, why do we use Require Export Basics, instead of Require Import basics? Also why does it work when we make Export basics.v, even if I changed the name of basics to Mybasics.v?
What does Require Export Basics. do? Does it import or export?
I tried to execute lists.v after compiling the induction.v but it doesn't work, it says
Unable to locate library Induction.
How can I fix that?

Are you working on software foundation? You need to add the folder to COQPATH. since proof general has handled that, i bet you are using coqide, aren't you?
The rest of your question can all be resolved by consulting the coq ref manual: https://coq.inria.fr/refman/toc.html .

The difference between Require Import and Require Export can be found here: https://coq.inria.fr/refman/vernacular.html#hevea_command115
Providing more information about compilation (e.g. whether you were using command line or code editor, Coq version, textbook version etc.) could be useful for resolving your issue.

Related

How to import all files at once pointed out by Dart Analysis?

I just put some of my code from a/b.dart to a/b1.dart file and now I started getting lot of errors on importing.
Is there any command or any other fix to import all a/b1.dart file in these files instead of manually opening each file and importing one by one.
I understand that a function or a property can be defined in more than two files and Dart can't make the right choice but if a function or property is defined in just one place, I think there must be some way to import it except searching for a/b.dart and replacing it with a/b.dart + a/b1.dart and then optimizing all imports.
As much as I am aware, Plugins/Extensions for your specific IDE (for dart) can be found that will help you with this problem.
I would recommend using dartdev tools - dartfix

Require module in Atom's init.coffee

I've already Google'd for an answer, since this is a common problem, but all the replies point in using alternatives instead of explaining why this doesn't work, so I'm asking here.
I put this code in my Atom's init.coffee script:
beautify = require('js-beautify').html
But Atom fails with Failed to load init.coffee and Cannot find module 'js-beautify'. Curiously enough, this works on a package and this works if I type the exact same code on Atom's console.
Of course, I could write a package for this, in fact there are a couple available, this is just an example because I want to learn how to require modules from init.coffee for future tweaks.
Thanks a lot!
When you require() from init.coffee, Atom looks for those modules in its own path. An example of where you might want to do that is if you had oni = require('oniguruma') to get access to regular expression functions.
In order to get to js-beautify, you have to specify its complete path. So far, only explicitly declaring the entire absolute path has worked for me:
beaut = require 'C:\\Users\\<username>\\.atom\\packages\\atom-beautify\\node_modules\\js-beautify'
console.log beaut
In practice, the most reliable way to use a module like this is to globally install it so that you can link to your global NPM folder. Linking to a module inside a package will break if the package is ever uninstalled.

From the Swift REPL, how do I get a list of available modules?

From the Swift REPL, I can import framework modules like Foundation by doing import Foundation.
What command can I give on the REPL that will produce a list of all the modules which are available to be imported?
ADDENDUM:
Just to be really clear what I'm trying to understand. On the REPL, if I type the words "import Foundation" then I can access the Foundation types, constants, etc.. If I type the words "import CoreGraphics" then I can access CoreGraphics. If I have the 3rd party library OptionKit installed, then typing "import OptionKit" lets me use OptionKit. These are all modules which can be directly imported from the REPL.
Some modules or frameworks, however, cannot. For instance, if I type "import ParseOSX" from the REPL, I get an error, even though it is possible to do "import ParseOSX" from a standalone script.
What I want to understand is just, how do I determine the list of frameoworks or modules which I can import, from the REPL, by using the import command.
ADDENDUM2:
I've done a little searching and it seems like the only 3rd-party framework I've successfully imported from /Library/Frameworks, OptionKit, is also the only one with a .swiftmodule file. And all the importable Apple frameworks seem to have their own .swiftmodule files, which you can find by searching under /Application/Xcode.app.
So this suggests you can import at runtime only the framework with .swiftmodule files. But I'm not sure of this.
If you're looking simply for the list, you might want to use:
:target modules list
That returns the full list of modules. Hope this help.

Fay: include another Fay file?

I have one Fay file which is the heart of my program, however I need some helpers for my logic, for instance a method to replace substrings. From what I understand, if I need such methods which are offered by many Haskell libraries from Hackage directly, I can't use those Haskell libraries, but I must copy-paste the code in my project. So it's what I did, I copy-pasted a "replace" function together with other helpers from the MissingH library in a new file in my project: Utils.hs.
That Utils.hs compiles without problems with Fay. Also I import it in my main Fay file and I get a JS file for the main project file without problems. However at runtime I get the following error:
ReferenceError: Utils$$36$ is not defined
I don't think that Fay will include the code from the helper file in my main JS file, so I'm including both JS files in the loading HTML. And to make even more sure that when I load the main file, that the utils file is loaded, I load it like that:
$.getScript("Utils.js", function(){
$.getScript("FayConfig.js");
});
But despite this I still get the error. I tried compiling the Utils.hs with "--library" but it didn't help.
So my question is, which setup do I need to achieve that the generated JS will find the helper functions that I put in another HS file, knowing that at compile-time, Fay (apparently) finds them without problems? Is there an example of such a setup online? Most of the Fay uses that I found have all the code in a single HS file, though they often use external Fay code from cabal, as with fay-jquery. In my case, setting up a cabal project just for these simple helpers would be overkill.
Which version of Fay are you using (fay --version)? It seems like you are using a version older than
0.16 where forgetting import Prelude wouldn't give any warnings, see this closed ticket. So upgrade fay and/or add import Prelude.
We're also considering renaming operators in the produced output to make error messages like these easier to understand.
You do not need to invoke fay several times, fay outputs all dependencies into the same js file. So there's no difference from using a cabal package in that regard.
Hope this helps, otherwise please give me a way to reproduce this.

'+' packaging or modular programming in matlab: analog of python's import?

I come with the background in languages like Java or Python where modular programming is enabled by packaging system and import directive (aka namespace aliasing). Historically MATLAB's approach to resolve problems like naming conflicts boils down to setting/playing with MATLABPATH, renaming/extending identifiers with prefixes, etc. So far I have been successfully playing with native MATLAB packaging by prepending plus sign "+" before the folder name (MATLAB notation for package also see here). Obviously they are very long to type ;-) Basically I am back to the similar problem as discussed here with no solution. So let me paraphrased for my particular angle:
Assume I have folder +mypackage defined containing file myfun.m with the function code of the same name.
How to achieve aliasing for MATLAB function inside the user (non-java) package as illustrated by the following python code:
from mypackage import myfun
?
[EDIT] Please note that AFAIK import keyword works only for java classes (with jvm attached to MATLAB process). No, import is working perfectly fine for both functions and aliases for objects and function of both Java and MATLAB origin.
Possibly related but not the same.
[EDIT2]
python's
from mypackage import myfun as anotherfun
is equivalent to MATLAB's
anotherfun = #mypackage.myfun
Doesn't
import mypackage.myfun
work?
link to documentation