0

This represents what I want, but which doesn't work:

syntax
  "_F_hex" :: "any => any" ("F;")
translations
  "F;" => "True,True,True,True"

I would use F; like this:

[F;,F;] == [True,True,True,True,True,True,True,True]

1 Answers1

2

Isabelle must be able to parse the right-hand side of a translation, but True,True,... does not yield a valid syntax tree. If you use F; only in list enumerations, you can extend the syntax translation rules for list enumerations as follows.

syntax "_F_hex" :: "logic" ("F;")
translations
  "[F;, xs]" => "CONST True # CONST True # CONST True # CONST True # [xs]"
  "[F;]" => "CONST True # CONST True # CONST True # CONST True # []"

Note that _F_hex does not take any argument, so its "type" is logic (and not something of the form _ => _) which stands for a parse tree node for a term. In the translations, you have to mark constants in the logic such as True with CONST. Otherwise, Isabelle would treat True as a variable.

Andreas Lochbihler
  • 4,998
  • 12
  • 10
  • Andreas, thanks again. Plug'n'play action now. You give the important answers when it's important. I've stumbled through defining a few recursive translations, but I wouldn't have gotten this, and it'll give me an important example to refer to when trying to implement recursive syntax. Here's a C language verifier you might be interested in: [VCC](http://vcc.codeplex.com/). I found it just yesterday. I don't know how useful it is, but it uses the Z3 verifier, and it's related to Isabelle with [HOL-Boogie](http://isabelle.in.tum.de/repos/isabelle/file/4dd08fe126ba/src/HOL/SMT_Examples) –  Jun 24 '14 at 14:57