I’m not a logic guru, but my intuition tells me what I’m looking for, is
what was named Skolem variables or Skolem constants, in Isabelle/HOL (and
not only known of the latter).
Don’t be to afraid of the two samples, the last comment will tell what to
look at mainly.
Here is something I wanted to write:
prfn utf8_c2_set
{c:int; UTF8_C2_LOWER <= c; c <= UTF8_C2_UPPER} ():
UTF8_C2(2, c) =
let
stacst b1:hb_C2
stadef c1:int = b1 - 0xC0
stacst b2:tb_80
stadef c2:int = (c1 * 64) + (b2 - 0x80)
prval pfd1:DATA(1, b1) = FIRST
prval pfc1:UTF8_C2(1, c1) = UTF8_C2_1(pfd1)
prval pfd2:DATA(2, b2) = NEXT(pfd1)
prval pfc2:UTF8_C2(2, c2) = UTF8_C2_2(pfc1, pfd2)
in pfc2 end
It fails, with many errors, including I can’t use subset sorts with
stacst
, and I had to write it this way instead, a way with which I very
unhappy (sorry) and I’m not even really sure it means what I intended:
prfn utf8_c2_set
{c2:int; UTF8_C2_LOWER <= c2; c2 <= UTF8_C2_UPPER}
{b1:hb_C2; c1:int; b2:tb_80}
{c1 == b1 - 0xC0; c2 == (c1 * 64) + (b2 - 0x80)}
(): UTF8_C2(2, c2) =
let
prval pfd1:DATA(1, b1) = FIRST
prval pfc1:UTF8_C2(1, c1) = UTF8_C2_1(pfd1)
prval pfd2:DATA(2, b2) = NEXT(pfd1)
prval pfc2:UTF8_C2(2, c2) = UTF8_C2_2(pfc1, pfd2)
in pfc2 end
Mainly, look at the stacst
and stadef
in the first version: I had to
move it all as constraints outside of the body, while it should be
constraints on local constants.
Well, obviously there are constraints to follow to invoke the desired
constructors. These are the constraints on the building block showing an
UTF8_C2(2, c)
is feasible for all c
in UTF8_C2_LOWER
to
UTF8_C2_UPPER
. But these constraints should not appear there, they should
not look like restricting the extend of the intended proof.
This kind of “inside out” issue when there are implicit existential
quantifications, reminds me some things for which I often get replied
talking about so called Skolem constants.
Still seeking for a solution, but I feel blocked.