ML-programming in Isabelle (beginner) - isabelle

I am learning how to write ML code in Isabelle (just started).
I am following the explanation and the examples in "The Isabelle Cookbook" (2013) and using Isabelle2017.
The function term_of and prop_of cannot be used anymore?
Examples on page 12 give rise to ML error:
ML error⌂:
Value or constructor (prop_of) has not been declared
What are the new functions?
Thank you.

Both of these need to be namespaced now: Thm.prop_of and Thm.term_of.

Related

source() functions preventing the read of downstream functions

I am trying to teach myself R and coming from a Python programming background.
I am clearly having problems with sourcing in one file (file_read_functions.R) when the functions stored in it are called from a file in the same directory (from read_files.R).
file_read_functions is as follows:
constant_source <- 'constants.R'
function_source <- 'file_read_functions.R'
class_source <- 'classes.R'
source(class_source)
source(constant_source)
source(function_source)
cellecta_counts = read_cellecta_counts(filepath = cell_counts_by_gene_id)
file_read_functions.R is as follows:
constants <- 'constants.R'
classes <- 'classes.R'
assignments <- 'assignment_functions.R'
source(constants)
source(classes)
source(assignments)
read_cellecta_counts = function(filepath) {
print("hello")
return(filepath)}
With the above, if I move read_cellecta_counts to before the source functions, the code can successfully find the function. What might be the cause?
This seems like a straight-forward error message to me. The function object wasn't found, so that means you haven't defined it anywhere, or haven't loaded it.
If it's a function from a package, maybe you forgot to load the package, or call the function as package::function(). If it is a function you wrote as a simple script, maybe you forgot to source it or define it locally. If it's a function you wrote as part of a package, you can load all functions by using the shortcut CTRL+SHIFT+L in RStudio.
That said, I believe you can benefit a lot from reading the chapter on Debugging from Hadley Wickham's "Advanced R" book. It is really well written and easy to understand, especially for beginners in the R language. The chapter will teach you how to use some debugging tools, either interactively or not. You can find it here.
I found it out. By commenting out the parts piece-wise in file_read_functions, I found that there a typo within assignment_functions.R. It was a simple typo; I had the following:
constant_source <- 'constants.R'
source(constants_source)
The extra 's' did it.
If you get an error like this in the future, be sure to check all of the upstream source() files; if there is an error in any of those it will not be able to find any proceeding functions.
Thank you all for your patience.

Adding Code of missing functions in frama-c

Forgive my ignorance. I need to do calculate backward slices for a project. After some searching, I came across frama-c. I downloaded the package on my ubuntu system which got me Frama-c Version: Fluorine-20130601. I am trying to use it for the first time. When finding out the undefined functions in my project almost all library functions are undefined, even printf, scanf etc(Neither code nor specification for function printf). According to the tutorial, I have to add stubs for all the undefined functions. Do I really have to add code for every library function that I am using even printf? Please guide.
You should update to Frama-C Phosphorus, which brings tons of improvements regarding Variadic functions. In particular, specifications are automatically generated for printf/scanf-like functions when they are called on a constant format string. For non-variadic functions, some basic implementations are available in the directory $FRAMA_C_INSTALL/share/libc/*.c (in recent releases of Frama-C).

Training the SyntaxNet POS Tagger in SytaxNet

I had some difficulties training SyntaxNet POS tagger and parser training and I could find a good solution which I addressed in Answers section. if you have got stuck in one of the following problem this documentation really helps you:
the training, testing, and tuning data set introduced by Universal Dependencies were at .conllu format and I did not know how to change the format to .conll file and also after I found conllu-formconvert.py and conllu_to_conllx.plI still didn't have a clue about how to use them. If you have some problem like this the documentation has a python file named convert.py which is called in the main body of train.sh and [train_p.sh][5] to convert the downloded datasets to readble files for SyntaxNet.
whenever I ran bazel test, I was told to run bazel test on one of stackoverflow question and answer, on parser_trainer_test.sh it failed and then it gave me this error in test.log: path to save model cannot be found : --model_path=$TMP_DIR/brain_parser/greedy/$PARAMS/ model
the documentation splited train POS tagger and PARSER and showed how to use different directories in parser_trainer and parser_eval. even if you don't want to use the document it self you can update your files based on that.
3. for me training parser took one day so don't panic it takes time "if you do not use use gpu server" said disinex
I got one answer from github from Disindex and I found it very useful.
the documentation in https://github.com/dsindex/syntaxnet includes:
convert_corpus
train_pos_tagger
preprocess_with_tagger
As Disindex said and I quote: " I thought you want to train pos-tagger. if then, run ./train.sh"

plot.predict() or predict.plot() functions cited in literature, but no longer exists

I am trying to use predict.plot or plot.predict (I've seen both of them referenced on various websites and I don't know which one is right).
However, in R, neither of these are valid functions. I don't know if I'm missing a package or if the sources I'm using are outdated in terms of the functions being referenced.
This site is using the function
It's very old. Can someone familiar with stats help me figure out how to do this with the latest version of R, or help me figure out how to get predict.plot/plot.predict to work?
This is a user defined function. The author of the course you linked to provides it online:
Link to R script
The S3 dispatch system for functions in R examines the class of the first argument and then calls a function with the name func.class. In this case the author has defined several plot.predict functions: predict.plot.data.frame, predict.plot.lm, and predict.plot.formula which are then given the arguments on hte basis of the class of what is (first) in the argument list. The plot.predict function is just this:
predict.plot <- function(object, ...) UseMethod("predict.plot")
The "good stuff" is in the other three functions at the link Roland provided. I do think the author's use of a dot in the name for the generic function is a bit confusing. One might have expected there to be a class "plot" for which there was a generic function predict, but that is not really the case here, although you might find it interesting to just type: methods(predict) .After you had loaded the R script on that website you could find those various functions using:
methods(predict.plot)
#[1] predict.plot.data.frame predict.plot.formula predict.plot.lm

Which language in DrScheme for SICP?

I have been using the Module for SICP in DrScheme 4.2 but which language has the best support for SICP in DrScheme?
Has anyone here tried this?
Thanks.
I don't think you need anything but R5RS which is available in DrScheme via Language > Choose Language....
You might want to allow redefinition of bindings. After you have selected R5RS, click on "Show Details" and uncheck "Disallow redefinition of initial bindings".
Some places in the text uses an error function, which is not available in R5RS. In these cases you can use srfi-23.
Another option is to simply use the "scheme" module language. Select "Module" as your language of choice and start your source files with #lang scheme or #lang scheme/base.
For the chapter "Example: A Picture Language" you can try this package (I have not tried it myself, so I don't know how well it works).
SICP Support for DrRacket
This package implements support in PLT’s DrRacket for Abelson and
Sussman’s Structure and Interpretation of Computer Programs (SICP) 2nd
Edition textbook, for students who wish to use DrRacket’s tools for
the SICP programming assignments.
http://www.neilvandyke.org/racket-sicp/
I am at the exact same place in SICP, and am using - 'Essentials of Programming Languages' as the language. It has not caused any problems yet.

Resources