jacquescarette / hol-light-qe Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jrh13/hol-light
The HOL Light theorem prover (moved from Google code)
License: Other
This project forked from jrh13/hol-light
The HOL Light theorem prover (moved from Google code)
License: Other
I am trying to prove the syntactic law of disquotation starting from how it is done in the paper - a case split over all possible types of epsilon. This works for QuoConst and QuoVar, but as soon as it gets to something more complicated like App, I run into the following issue.
val it : goalstack = 1 subgoal (3 total)
0 [`x = App a0 a1`]
`(eval (x) to (A)) = CTT x`
There is no restriction that a0
must be a QuoConst
of type A->B
, and I have not yet been able to find any way to enforce this restriction. Since the type is unknown to HOL, I am unable to prove isExpr
, and can't use the axioms to continue with the proof.
What would be the best way to resolve this problem?
Dr. Farmer has told me that quotations have no free variables, and thus it should not be possible to substitute into one. My question is - at what stage does this happen? To quote something in my current implementation of HOL QE, you'd preface it with a _Q_
, so the quotation of a boolean variable would go through three "stages":
_Q_ (x:bool)
Applying the theorem named QUOTE
would result in:
Q_ (x:bool) _Q
And applying the theorem named TERM_TO_CONSTRUCTION
would result in:
QuoVar "x" (TyBase "bool")
At which stage of this process should it no longer be possible to substitute into x, or should it not be allowed in all 3?
I'm trying to trace through the program to find the source of some of the bugs I'm encountering, and it seems like the only way to debug the program or even get a stack trace is by compiling the program with the -g option.
How would I go about compiling HOL? It seems to use various statements the ocamlc compiler doesn't recognize, namely, it fails on the first file, system.ml because of the use of a #load directive, and I'm sure there will be other issues once this is fixed.
I am having issues with implementing isTypeValid - I need it to recursively check that the types given inside the list of types are valid as well. However, HOL refuses any attempts to do this because it cannot prove a wellfounded ordering.
I've looked at the tutorial (page 164) and the solution John Harrison uses in these circumstances is to define a recursive function to calculate the "size" of a problem and use that to prove that the problem size is constantly decreasing, but it refuses to do that too for the same reasons.
Namely, this is the goal that I need to define an ordering to satisfy:
`?(<<). WF (<<) /\
(!str a b. b << TyCons str [a; b]) /\
(!str a b. a << TyCons str [a; b]) /\
(!str a. a << TyCons str [a])`
I would like to confirm that I am understanding what each of the functions laid out in Dr. Farmer's paper should accomplish, as I am slightly confused as to what some of them should do. Would it be possible to confirm that the definitions below are correct and correct any that are not?
is-var: Given anything in type epsilon, returns boolean true if the given item is of type QuoVar, otherwise returns false
is-var-alpha: Same as is-var, but also takes a type, returns boolean true if the given item is a QuoVar of type alpha, else false.
is-cons/is-cons-alpha: Function exactly the same as is-var/is-var-alpha respectively, but with QuoConsts instead of QuoVars
app: Given two items e1 and e2 both of type epsilon, returns (App e1 e2)
abs: Given two items e1 and e2 both of type epsilon, returns (Abs e1 e2)
quo: Takes a type epsilon and applies the quotation operation - essentially a quotation operator restricted to type epsilon?
is-expr: This is the main one I am confused about - is it checking that an expression is eval-free? If so, what would this look like considering we have yet to define an Eval operator inside epsilon?
is-expr-alpha: Same as is-expr but checks that the expression's type is that of alpha as well
The second last one that looks like a [ : Also confused by this one - the paper says it's true if the first expression is a valid sub-expression of the second - what is meant by valid sub-expression here? Is it simply checking that e1 is located somewhere inside e2, or is it checking that the expression makes sense as well? (e.g. false if an attempt is made to apply constant "5" to constant "3" for example)
is-free-in: If the first expression (has to be a variable) appears free anywhere inside the second, return true
Thank you!
I've fixed the unquote logic, added isConstruction, fixed recursive functions, and included a way to turn constructions back into quoted terms. Is there anything I still need to do for quotation? If not, what should I be doing next?
Thanks!
I spoke with Dr. Farmer this morning about an operation called isConstruction that would verify that an epsilon term construction represents a quoted term. The example I was shown where to apply this would be when using quasi quotation to substitute into a quotation.
Are there any other scenarios where an epsilon construction would fail isConstruction? If not, would it be easier to implement quasi quotation first and then add this check?
Edit: Also - what would be the best way to go about implementing quasi quotation? I'm thinking another addition to HOL's term definitions may be necessary, since these are a separate class of variables and would not really fit in to Var. The other idea I have come up with is a special constructed type for Vars to "mark" them but this seems like a messier solution.
I have currently defined isConstruction as:
let isConstruction = define `
(isConstruction (QuoVar str ty) = T) /\
(isConstruction (QuoConst str ty) = T) /\
(isConstruction (App exp1 exp2) = ((isConstruction exp1) /\ (isConstruction (exp2)))) /\
(isConstruction (Abs exp1 exp2) = ((isConstruction exp1) /\ (isConstruction exp2))) /\
(isConstruction (Quo exp1) = (isConstruction exp1))
`;;
This means that while it should return true when the term is a construction, it will never return false, and so something like isConstruction ((f x):epsilon)
will just be unprovable instead of returning a definite result. Is this alright?
I've noticed that beta conversion is slightly broken when working with evaluations in some specific cases, and I'd like to confirm that my assumptions about these are correct:
(\x. A) y where x and y are not the same, and A is not eval free but is also not an eval itself. For example, (\x. 3 + (eval x to num) = x) 2
- should the y term be brought inwards to create something like 3 + (\x. eval x to num) 2 = 2
, or should something else happen?
(\x. A) y where x and y are different, A is eval free, but y is not eval free, such as (\x. x) (eval x to num)
. I'm assuming here that nothing special needs to be done, the eval term can just be substituted in for x?
Thanks!
I am having a bit of trouble understanding what some of the types defined in John Harrison's paper actually do, namely:
Ind (I'm assuming this means an inductive type defined in terms of itself such as term's Comb or Abs, would a reliable way to check for these be to check for types that map to themselves such as :term->term?)
Equal type
Select type
What expressions would cause these terms to be generated when quoted?
I have discovered that my pseudoquotation implementation is incapable of quoting strings or lists - internally, a string is of type (char)list, while a list is generally of the type (A)list, where A can be any type.
How could this be represented inside the type
type? I know Tyvar can be used to represent "A", but how would this be combined with another type such as a list?
Hello Dr. Farmer,
I met with Dr. Carette today, who said that the way to implement Eval to work on variables is to have it include an environment parameter, which maps variables to terms, and should throw an exception if the variable is undefined in the environment.
Could you provide any input on whether or not this method is the best way to go about implementing Eval?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.