GithubHelp home page GithubHelp logo

Comments (17)

JacquesCarette avatar JacquesCarette commented on June 29, 2024

[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.

laskowsp avatar laskowsp commented on June 29, 2024

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.

laskowsp avatar laskowsp commented on June 29, 2024

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.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

Re: unquote - yes, I meant eval.

Re: proving inequality. Yes, it is always best to emulate what HOL already does.

from hol-light-qe.

laskowsp avatar laskowsp commented on June 29, 2024

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.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

That's great. Well done.

from hol-light-qe.

laskowsp avatar laskowsp commented on June 29, 2024

What should I focus on next?

from hol-light-qe.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

start on eval ?

from hol-light-qe.

laskowsp avatar laskowsp commented on June 29, 2024

Alright, should I make eval an HOL function or another "special" term like Quote and Hole?

from hol-light-qe.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

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.

laskowsp avatar laskowsp commented on June 29, 2024

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.

laskowsp avatar laskowsp commented on June 29, 2024

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.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

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.

laskowsp avatar laskowsp commented on June 29, 2024

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.

JacquesCarette avatar JacquesCarette commented on June 29, 2024

ok

from hol-light-qe.

wmfarmer avatar wmfarmer commented on June 29, 2024

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.

laskowsp avatar laskowsp commented on June 29, 2024

I see, thank you, I will make the change.

from hol-light-qe.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.