*To*: John Munroe <munddr at gmail.com>*Subject*: Re: [isabelle] Subtyping*From*: Christian Sternagel <christian.sternagel at uibk.ac.at>*Date*: Wed, 24 Aug 2011 10:48:10 +0200*Cc*: isabelle-users at cl.cam.ac.uk, "Tim \(McKenzie\) Makarios" <tjm1983 at gmail.com>*In-reply-to*: <CAP0k5J6RHg1OwtJNOrjz-fh4dL7HcY3x6AsDJnnv_qBQusUuFA@mail.gmail.com>*References*: <CAP0k5J7vOgpcrUqVy5s4gAsQf1zAtr4gH-wiXjj=Ge7bBHYVfQ@mail.gmail.com> <4E546478.7030708@gmail.com> <CAP0k5J6RHg1OwtJNOrjz-fh4dL7HcY3x6AsDJnnv_qBQusUuFA@mail.gmail.com>*User-agent*: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

(sorry for multiple copies) Hi there,

datatype 'a + 'b = Inl 'a | Inr 'b

fun is_Inl where is_Inl (Inl _) = True" | is_Inl (Inr _) = False" Hope this helps. cheers chris On 08/24/2011 05:32 AM, John Munroe wrote:

On 24/08/11 11:03, John Munroe wrote:Hi, I'm trying to define a function 'f' such that when the input is of type 'A' it gives true, but when it's of type 'B' it gives false: Would I need to make A and B subtypes of some parent type, say, 'P', and that 'f' is of type "P => bool"? I can't seem to find much documentation on subtyping.It sounds like you might want to use a sum type, so that the type "'p" is "'a + 'b". There was a discussion about this quite recently on this very list, starting here: http://tinyurl.com/3jzx3ny Then you could have something like "f p = \<exists> a. p = Inl a" (but I haven't tested this).Thanks for that. I'm not certain if I properly understand "f p = \<exists> a. p = Inl a". So, for my example, is the type of f "A + B => bool"? This is what I have: typedecl A typedecl B axiomatization f :: "A + B => bool" where ax1 : "f p = (EX a. p = Inl a)" consts a :: "A + 'b" lemma "f a = True" apply (simp add: ax1) ?? I can't seem to find out what Inl actually does. It's defined in Sum_Type to be "Inl = Abs_sum \<circ> Inl_Rep", but I can't seem to find where Abs_sum is defined. Thanks JohnTim <>< -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5UZHMACgkQ/cBxZIxl6rmwnACfdWxXr+HPTl/8EOuAg0Y6j1Ai 378An1HvQucFMwMdkCUv4a+PtWuAXzbO =Z7Ie -----END PGP SIGNATURE-----

**References**:**[isabelle] Subtyping***From:*John Munroe

**Re: [isabelle] Subtyping***From:*Tim (McKenzie) Makarios

**Re: [isabelle] Subtyping***From:*John Munroe

- Previous by Date: Re: [isabelle] Subtyping
- Next by Date: Re: [isabelle] Subtyping
- Previous by Thread: Re: [isabelle] Subtyping
- Next by Thread: Re: [isabelle] Subtyping
- Cl-isabelle-users August 2011 archives indexes sorted by: [ thread ] [ subject ] [ author ] [ date ]
- Cl-isabelle-users list archive Table of Contents
- More information about the Cl-isabelle-users mailing list