问题
I have the following definition in Isabelle (for details see here):
definition gluing :: "(((real × real) × bit) × (real × real) × bit) set" where
"gluing = {(((x0,y0),l),((x1,y1),j)).
((x0,y0) ∈ e_circ ∧ (x1,y1) = τ (x0,y0) ∧ j = l+1) ∨
(x0 = x1 ∧ y0 = y1 ∧ l = j)}"
Now, this gluing is supposed to be defining an equivalence relation over the set:
e_aff × (range Bit)
So I would like to refine the type:
(real × real) × bit
to this. If I do it directly on the definition of gluing I get:
Undefined type name: "e_aff"⌂
But if I instead try to do it through a type definition:
typedef e_aff_t = "e_aff"
I get:
Illegal variables in representing set: "d" The error(s) above occurred in typedef "e_aff_t"
I think this comes from the internal definition of e_aff
.
How should I solve it?
回答1:
I will provide several remarks. If these are not sufficient, please feel free to ask further questions and I will try to do my best to reply.
But if I instead try to do it through a type definition:
typedef e_aff_t = "e_aff"
I get:
Illegal variables in representing set: "d" The error(s) above occurred in typedef "e_aff_t"
This happens because e_aff
depends on fixed variables. To the best of my knowledge, this is not accepted by the logic at the moment (with the exception of limited support through Local Typedef Rule from Types-To-Sets):
typedef α k = S
requires S
to be a closed term, k
to be a
fresh type constructor and all type variables in S
need to be among the
variables in α
. In your case, S
is not a closed term. There are many valuable resources that explain this in detail and many of them are referenced in the PhD thesis of Ondřej Kunčar.
Plausible solutions
The possible options are presented in the order of my personal preference, given what I know about your application. However, keep in mind, that this may not be an exhaustive list, given my own limited experience, and, also, I know very little about your end goal.
Set-based quotients
I believe that the simplest way to express that gluing
is an equivalence relation on e_aff × UNIV::bit
is
definition qs where "qs = (e_aff × (range Bit)) // gluing"
lemma "equiv (e_aff × (range Bit)) gluing"
sorry
Once this is done, the theory Equiv_Relations
(among others) provides many useful theorems for dealing with set-based quotients.
Types-To-Sets
You also have the option to use Local Typedef Rule from Types-To-Sets to create a context with the quotient_type
based on fixed variables. However, you would still need to convert the type-based theorems to their set-based counterparts before you can use them in any application (the conversion is automated). If you are interested, I can provide more details and an example. However, I believe, for your application, this is hardly more superior than dealing with the set-based theorems directly.
quotient_type
If, for any reason, you still insist on using the type-based approach, then, I guess, you could try restating the theory in a way such that e_aff
does not depend on fixed variables. For this, you can use Hilbert choice, e.g. definition c where "c = (SOME c::real. True)"
, etc... However, I do not believe that this is a standard practice and would be encouraged.
来源:https://stackoverflow.com/questions/57151472/refining-a-definition-in-isabelle