Received: from leopard.cs.byu.edu (leopard.cs.byu.edu [128.187.2.182]) by ra.abo.fi (8.6.10/8.6.10) with ESMTP id UAA13493; Tue, 6 Feb 1996 20:04:55 +0200
Received: by leopard.cs.byu.edu
	(1.37.109.15/16.2) id AA038673572; Tue, 6 Feb 1996 09:19:32 -0700
Sender: info-hol-request@leopard.cs.byu.edu
Errors-To: info-hol-request@leopard.cs.byu.edu
Precedence: list
Received: from tuminfo2.informatik.tu-muenchen.de by leopard.cs.byu.edu with ESMTP
	(1.37.109.15/16.2) id AA038603437; Tue, 6 Feb 1996 09:17:17 -0700
Received: by tuminfo2.informatik.tu-muenchen.de via suspension id <26956-4>; Tue, 6 Feb 1996 17:10:57 +0100
Received: from sunbroy14.informatik.tu-muenchen.de ([131.159.0.114]) by tuminfo2.informatik.tu-muenchen.de with SMTP id <26821-1>; Tue, 6 Feb 1996 17:02:40 +0100
Received: by sunbroy14.informatik.tu-muenchen.de id <8173>; Tue, 6 Feb 1996 17:02:28 +0100
From: Konrad Slind <slind@informatik.tu-muenchen.de>
To: reetz@ira.uka.de, info-hol@leopard.cs.byu.edu
Cc: reetz@ira.uka.de, schneide@ira.uka.de
In-Reply-To: <"iraun1.ira.505:06.02.96.13.38.42"@ira.uka.de> (message from reetz on Tue, 6 Feb 1996 14:37:28 +0100)
Subject: Re: How do I get the definition of a constant in HOL90?
Message-Id: <96Feb6.170228met.8173@sunbroy14.informatik.tu-muenchen.de>
Date: 	Tue, 6 Feb 1996 17:02:22 +0100


> Given the name of a constant "X", how do I get the definition of that
> constant in HOL90 in a COMPUTABLE way? 

You could try the following: it functions by finding the first
definition in which the constant occurs.


fun find_def s =
let val {theory,...} = const_decl s
    fun drop_dollar s = (case(explode s) of ("$"::rst) => implode rst | _ => s)
    fun our_const c = (drop_dollar(#Name(dest_const c)) = s) handle _ => false
in first (can (find_term our_const) o concl o #2) (rev(definitions theory))
end;


Notes. 

* In the implementation, definitions are stacked up, so the list
  returned by "definitions" needs to be reversed. 

* It won't catch members of constant families, like numeric or string
  literals. 

* It won't catch surface syntax, like "{}" (in the sets library).

Konrad.
