Re: [isabelle-dev] sets and code generation

2012-03-27 Thread Jesus Aransay
Dear all,

trying to import simultaneously the theory file
"HOL/Matrix/Matrix.thy" and the afp entry
http://afp.sourceforge.net/entries/Matrix.shtml into a file, it seems
that the second theory file "unloads" the first one (as Makarius
suggested in his mail):

theory Matrix_ex
  imports
  "~~/src/HOL/Matrix/Matrix"
  "Matrix/Matrix"
begin

Is there an easy way out of this situation in Isabelle2011-1? Renaming
one of the theory files is an acceptable solution in this case?

Thanks for your help,

Jesus

On Fri, Mar 23, 2012 at 1:25 PM, Makarius  wrote:
> On Fri, 23 Mar 2012, Christian Sternagel wrote:
>
>> Maybe the AFP entry for executable matrix operations is useful for you.
>>
>> http://afp.sourceforge.net/entries/Matrix.shtml
>>
>>> (HOL/Matrix/Matrix.thy).
>
>
> Note that in current Isabelle/08c22e8ffe70 HOL/Matrix is actually called
> HOL/Matrix_LP, in order to avoid a name clash of the AFP/HOL-Matrix session
> (the latter was introduced later, but AFP names are not so easy to change as
> I understand it).
>
> Technically, the motivation is to get globally unique session names for
> official Isabelle + AFP sessions.  Then when we eventually get a decent
> build system (based on Isabelle/Scala), the user can refer to sessions
> robustly without tinkering IsaMakefiles or funny search paths.
>
>
>        Makarius
>
> ___
> isabelle-dev mailing list
> isabelle-...@in.tum.de
> https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev



-- 
Jesús María Aransay Azofra
Universidad de La Rioja
Dpto. de Matemáticas y Computación
tlf.: (+34) 941299438 fax: (+34) 941299460
mail: jesus-maria.aran...@unirioja.es ; web: http://www.unirioja.es/cu/jearansa
Edificio Luis Vives, c/ Luis de Ulloa s/n, 26004 Logroño, España
___
isabelle-dev mailing list
isabelle-...@in.tum.de
https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev


Re: [isabelle-dev] sets and code generation

2012-03-23 Thread Jesus Aransay
Dear all,

after reading the thread about code generation from sets I was
wondering myself if there would be any chance to apply such ideas to
the definition of matrices in the distribution
(HOL/Matrix/Matrix.thy).

The matrix type definition reads as follows:

type_synonym 'a infmatrix = "nat \ nat \ 'a"

definition nonzero_positions :: "(nat \ nat \
'a::zero) \ (nat \ nat) set" where
  "nonzero_positions A = {pos. A (fst pos) (snd pos) ~= 0}"

typedef 'a matrix = "{(f::(nat \ nat \
'a::zero)). finite (nonzero_positions f)}"
proof -
  have "(\j i. 0) \ {(f::(nat \ nat
\ 'a::zero)). finite (nonzero_positions f)}"
by (simp add: nonzero_positions_def)
  then show ?thesis by auto
qed

I know there is an alternative way to get that, by means of sparse
matrices (SparseMatrix.thy), but it demands translating every
operation over the matrix type to its equivalent version for "sparse
matrices", which may be sometimes hard work.

Thanks in advance for any hint,

Jesus

On Wed, Mar 21, 2012 at 5:40 PM, Florian Haftmann
 wrote:
> Hi Christian,
>
>> since set is a proper type some code equations that used to work, no
>> longer do, e.g.,
>>
>> "op |> = {(x, y). supt_impl x y}"
>
> there is a couple of issues you are hitting at here.
>
> A. The (re-)introduction of the set type constructor
>
> See
> http://www.mail-archive.com/isabelle-dev@mailbroy.informatik.tu-muenchen.de/msg01736.html
> for one possible entry into the motivation and discussion concerning that.
>
> B. The default code generation for setup
>
> You can always turn back to sets-as-predicates by
>
>        code_datatype Collect
>
> and then proving appropriate theorems for the set operation etc. – this
> would fir best into a library theory which could then be part of the
> distribution.  But I guess your issue is mainly with…
>
> C. Relations
>
> Both kinds of relations 'a => 'a => bool and ('a * 'a) set are present
> in their own right, but with disjoint developments in the HOL theoris.
> Note that you can convert between both using pred/set conversions, the
> same infrastructure as inductive_set is using.
>
> So, if you want predicate relations, it seems to be best to convert your
> stuff to them, filling existing gaps in the HOL theories by additional
> definitions and suitable pred/set conversion declarations.
>
> See theory "Relation" for examples for making use of pred/set
> conversions by means of attributes "to_set" and "to_pred"; and
> declarations of pred/set conversions by means of attribute "pred_set_conv".
>
> Unfortunately, there is no reference for them in the Isabelle Reference
> Manual.  Maybe one day this is subsumed by an emerging generic »lifting«
> infrastructure.
>
> Hope this helps,
>        Florian
>
> --
>
> PGP available:
> http://home.informatik.tu-muenchen.de/haftmann/pgp/florian_haftmann_at_informatik_tu_muenchen_de
>
>
> ___
> isabelle-dev mailing list
> isabelle-...@in.tum.de
> https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev
>



-- 
Jesús María Aransay Azofra
Universidad de La Rioja
Dpto. de Matemáticas y Computación
tlf.: (+34) 941299438 fax: (+34) 941299460
mail: jesus-maria.aran...@unirioja.es ; web: http://www.unirioja.es/cu/jearansa
Edificio Luis Vives, c/ Luis de Ulloa s/n, 26004 Logroño, España
___
isabelle-dev mailing list
isabelle-...@in.tum.de
https://mailmanbroy.informatik.tu-muenchen.de/mailman/listinfo/isabelle-dev