Comments (17)
[Excuse the informal syntax, I forget the details]
Can you prove that not (quote (1+1) = quote (2)
but unquote (quote (1+1)) = unquote (quote 2))
?
from hol-light-qe.
not (quote (1+1) = quote (2))
should be doable, I will test it and reply with the results, but unquote
is for taking out holes, not an implementation of eval, so I do not think the second one is provable with the tools at hand.
from hol-light-qe.
Alright, I have tested the first one and have been able to reduce it to
`~(App
(App
(QuoConst "+"
(TyBiCons "fun" (TyBase "num")
(TyBiCons "fun" (TyBase "num") (TyBase "num"))))
(App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))))
(App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))) =
App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT0" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))))`
but there is no way to prove inequality. The way HOL handles this for defined types such as strings and characters is with a conversion function that accepts an equality and returns a theorem asserting that the equality is either true or false. An example of this would be STRING_EQ_CONV
, so I think the best course of action is to emulate the native way of doing it and implement an EPSILON_EQ_CONV
which works the same way.
from hol-light-qe.
Re: unquote - yes, I meant eval.
Re: proving inequality. Yes, it is always best to emulate what HOL already does.
from hol-light-qe.
It appears that I forgot about the two definitions I had HOL generate - epsilonDistinct and epsilonInjective. These are enough to prove that the two terms are unequal without the need to add in extra conversion functions. Here is the complete proof from start to end:
# g(`~(Q_ 1 + 1 _Q = Q_ 2 _Q)`);;
val it : goalstack = 1 subgoal (1 total)
`~(Q_ (1 + 1) _Q = Q_ (2) _Q)`
# e(REPEAT TERM_TO_CONSTRUCTION_TAC);
;;
val it : goalstack = 1 subgoal (1 total)
`~(App
(App
(QuoConst "+"
(TyBiCons "fun" (TyBase "num")
(TyBiCons "fun" (TyBase "num") (TyBase "num"))))
(App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))))
(App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))) =
App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT0" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))))`
# e(REWRITE_TAC[epsilonInjective]);;
val it : goalstack = 1 subgoal (1 total)
`~(App
(QuoConst "+"
(TyBiCons "fun" (TyBase "num")
(TyBiCons "fun" (TyBase "num") (TyBase "num"))))
(App (QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(App (QuoConst "BIT1" (TyBiCons "fun" (TyBase "num") (TyBase "num")))
(QuoConst "_0" (TyBase "num")))) =
QuoConst "NUMERAL" (TyBiCons "fun" (TyBase "num") (TyBase "num")) /\
"NUMERAL" = "BIT0")`
# e(REWRITE_TAC[epsilonDistinct]);;
val it : goalstack = No subgoals
# top_thm();;
val it : thm = |- ~(Q_ (1 + 1) _Q = Q_ (2) _Q)
from hol-light-qe.
That's great. Well done.
from hol-light-qe.
What should I focus on next?
from hol-light-qe.
start on eval
?
from hol-light-qe.
Alright, should I make eval an HOL function or another "special" term like Quote and Hole?
from hol-light-qe.
I am not 100% sure. I think it can be made a HOL function (which is preferable), but there might be hiccups. Hopefully Dr. Farmer will chime in at some point.
from hol-light-qe.
Alright, I'll get started on implementing it as an HOL function but changing it to it's own term shouldn't be too hard if necessary.
from hol-light-qe.
Is it safe to assume that eval will always be called on a quote? e.g.
eval (Q_ 3 _Q)
would be valid but
eval (3 = Q_ 2 _Q)
or eval ((f x):epsilon)
would not?
from hol-light-qe.
eval
can be called on anything which is equivalent to a quote - it does not have to be a quote. Not sure if you can deal with that in the type system?
from hol-light-qe.
I do not think that is doable in the type system, I think something similar to how holes work would be best here - allow eval to be applied to anything but the theorem that handles performing the evaluation itself requires the user to simplify the thing representing the quote to an actual quote.
from hol-light-qe.
ok
from hol-light-qe.
eval needs to be a new term constructor like quote. Its semantics prevents it from being an HOL function. eval has two arguments, a term t of type epsilon and a type alpha. The type of "eval t alpha" is alpha. quote can only be applied to eval-free terms.
from hol-light-qe.
I see, thank you, I will make the change.
from hol-light-qe.
Related Issues (12)
- Meaning of some of John Harrisons's types HOT 8
- Eval on variables HOT 15
- Issue with epsilon variables in syntactic law of disquotation proof HOT 23
- Questions regarding beta conversion and evals HOT 3
- Specification of functions for Epsilon HOT 3
- Regarding parameterized types HOT 1
- Recrusion on list elements in HOL HOT 8
- Compiling OCaml code? HOT 2
- At what point should substitution no longer work on quotations? HOT 1
- isConstruction implementation HOT 15
- isConstruction HOT 2
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 hol-light-qe.