[metis-users] A question relating to unit clause reduction in Metis
Joe Hurd
joe at gilith.com
Mon Aug 8 23:57:12 UTC 2011
Hi James,
[I'm cc'ing this to the metis-users mailing list, to keep a permanent
record of questions and answers about the codebase.]
What's happening in the reduce function is that the set "units" of
theorems is being used to simplify the theorem "th". The red1 function
goes through each literal "lit" in th one by one, and if it can use
units to justify deleting lit from th then it does so. This is the
part that you know, I'm just including it here for context.
The particular step you asked about is the result of deleting a
literal from the theorem stored in units. If this theorem is actually
a unit theorem then the result will always be an empty theorem (as you
say), but actually you can store any theorem you want in units. For
example, suppose you stored the theorem
|- x = 0 \/ y = 0 \/ ~(x * y = 0)
in units with only the last literal "exposed for matching", then
calling the reduce function on a theorem th would have the effect of
replacing literals in th of the form
x * y = 0
with the two literals
x = 0 \/ y = 0
In an arithmetic application this might be a useful thing to do.
Hope that helps,
Joe
On Mon, Aug 8, 2011 at 6:00 AM, James Bridge <jpb65 at cam.ac.uk> wrote:
> Hi Joe,
>
> I have a question about the following code from Units.sml in Metis (actually
> in MetiTarski but I think it is unchanged from Metis). I've copied the whole
> function but my question relates to the role of new (and news). My
> understanding is that both the negation of lit, i.e. lit' and the matched
> unit clause rth are both single literals and equal to each other so when
> lit' is deleted from rth I'd expect that there should be nothing left - i.e.
> new should always be empty and so should news?
>
> Am I missing something obvious?
>
> James
>
> fun reduce units =
> let
> fun red1 (lit,news_th) =
> case total Literal.destIrrefl lit of
> SOME tm =>
> let
> val (news,th) = news_th
> val th = Thm.resolve lit th (Thm.refl tm)
> in
> (news,th)
> end
> | NONE =>
> let
> val lit' = Literal.negate lit
> in
> case match units lit' of
> NONE => news_th
> | SOME ((_,rth),sub) =>
> let
> val (news,th) = news_th
> val rth = Thm.subst sub rth
> val th = Thm.resolve lit th rth
> val new = LiteralSet.delete (Thm.clause rth) lit' <<<< won't
> new always be empty??
> val news = LiteralSet.union new news
> in
> (news,th)
> end
> end
>
> fun red (news,th) =
> if LiteralSet.null news then th
> else red (LiteralSet.foldl red1 (LiteralSet.empty,th) news)
> in
> fn th => Rule.removeSym (red (Thm.clause th, th))
> end;
>
>
More information about the metis-users
mailing list