History log of /seL4-l4v-master/HOL4/src/datatype/record/RecordType.sml
Revision Date Author Comments
# 3383b4b9 18-Nov-2019 Michael Norrish <Michael.Norrish@nicta.com.au>

Remove "big records" optimisation


# 2d8bef7a 18-Nov-2019 Michael Norrish <Michael.Norrish@nicta.com.au>

Improve TypeBase API for reporting on record fields

Datatype code now bypasses treatment of "big records". This stuff can
all be deleted and I will be happy to see it go as it is horrifically
complicated, and usually only serves to confuse users.

Thanks to a CakeML Slack discussion for the push to make the API
change.


# 1e0d2028 11-Apr-2018 Michael Norrish <Michael.Norrish@nicta.com.au>

Re-implement Datatype package with TypeBase sexps (not adjoin)


# ececd5ef 13-Dec-2015 Michael Norrish <Michael.Norrish@nicta.com.au>

Make record type definition less chatty

When proving and storing the various helper theorems, don't emit the
"saved theorem" messages to the user. (Interactively, the messages
don't appear; I don't think they need to appear when Holmake is running
either.)


# 1af1c8d3 15-Nov-2015 Michael Norrish <Michael.Norrish@nicta.com.au>

Work on making record fupd fns more polymorphic

This is github issue #173.

Selftest checks for right behaviour. But an earlier test is failing
because the handling of "big records" hasn't been completely updated.


# 70888e0c 02-Jun-2015 Michael Norrish <Michael.Norrish@nicta.com.au>

RecordType: use mk_thy_const instead of mk_const

Closes #260


# ed6c520b 13-Jan-2015 Michael Norrish <michael.norrish@nicta.com.au>

Delete some unused code


# 5957dac9 13-Jan-2015 Michael Norrish <michael.norrish@nicta.com.au>

Correct a minor indentation glitch


# 6da728bc 13-Jan-2015 Michael Norrish <michael.norrish@nicta.com.au>

Ensure record type constructor names don't interfere with user names.

When you declare a type like

foo = <| n : num ; b : bool |>

there is an underlying constructor defined called foo:

foo : num -> bool -> foo

This underpins the definition of the various functions over record
types, which are made with the recursion principle for this underlying
algebraic type. However, with sufficient care/malice, this constant
(which users are typically oblivious to), can interfere with other
definitions to ill effect.

The fix is to make the constant take a name that can't even be
generated by the parser, but to then overload the name ("foo" in the
example) to this constant. The parser is happy to have a string
overload to multiple constants; the internal theory signature
mechanism has to prevent multiple constants from having the real name.
(Before the fix, the kernel signature maintenance lets the second
definition of a constant with this name go through but invalidates the
first constant, causing a theory to purge itself of what the user
thinks is a perfectly valid type.)

This solves one of the problems identified in github issue #224.


# 227b5fdb 02-Apr-2009 Michael Norrish <Michael.Norrish@nicta.com.au>

My change to the behaviour of GEN_TAC caused record proofs to break if
the record name began with the name of a constant. Fixed by making
RecordType's proofs more robust. Test-case also included.


# 8389ab25 29-Apr-2008 Scott Owens <Scott.Owens@cl.cam.ac.uk>

Rename Lib.concat to Lib.strcat so that when Lib is opened (via HolKernel) in
an interactive session, the SML pervasive concat isn't shadowed.


# 5d6a6595 09-Jun-2006 Konrad Slind <konrad.slind@gmail.com>

The new changes to records have been fixed so that the system
will rebuild without error. Whether the record stuff actually
does what it should, I am still checking. The big record
stuff will have to be checked in Australia, probably, since
I don't really understand it.


# a37e5a74 09-Jun-2006 Konrad Slind <konrad.slind@gmail.com>

Fixes to support code generation for records. Incomplete! So
do not update these changes (I'm just using CVS to transfer
files to work machine).


# 007e43f2 31-May-2005 Konrad Slind <konrad.slind@gmail.com>

Follow-on fixes to changing Term to Parse.Term and Type to Parse.Type
in the quotation pre-processor. A mass of trivial changes, but the
new way of dealing with files containing code that does parsing
(not script files) is to

* grab the ambient grammar(s)
* set the current grammar(s) to the right values
for parsing quotations in the file
* the body of the file
* reset the current grammar to the ambient grammar

For an example, see src/taut/tautLib.sml


# bbea9bc2 27-Sep-2004 Konrad Slind <konrad.slind@gmail.com>

A load of changes aimed at supporting records better. And some other
odds and ends.


# 75a53f38 17-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

I think I've done records to death. This latest (and hopefully
last) improvement speeds things up for a forty field record from 44
seconds to 27 seconds. It does this by eliminating update functions.
Instead, all updates are implemented with functional updates. (The new
documentation in DESCRIPTION explains this.) There are thus many fewer
theorems proved and stored, and initialisation of the stateful rewriter
should be that much faster too.


# 46e76807 16-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

Missed out some theorems that need exporting.


# 8c6be89f 11-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

Prove and export more theorems needed to make big records work properly.
These are conceivably useful in a general setting too. For example:
fld1_fupd f o fld_fupd g = fld1_fupd (f o g)
where
fld1_fupd f : recd -> recd
updates field1 by applying f to it.


# f11bfc48 10-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

This theorem was being written out to be "adjoined" but wasn't being
added to the tyinfos generated at datatype definition time. This meant
that using a type in a loaded theory differed from using it in a
current theory. Now, neither loaded nor current theories include rewrites
to rewrite away functional update constants. These are important to keep
because the big record encoding uses functional updates.


# fd29ed06 05-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

(Shades of earlier discussion about problems in prob. directory!)
I realised that I need to prove both (f o g = g o f), and also
f o (g o h) = g o (f o h), where f and g are record update functions.


# 55d30c1b 05-Feb-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

Export some new theorems as a result of record type definition. (Also
deleted a couple of exports that have been deadwood for a while.) This is
so that I can fix an exponential blow-up in part of my big record type
"solution" (one designed to fix an O(n^2) problem :-)


# f770ee34 07-Jan-2003 Michael Norrish <Michael.Norrish@nicta.com.au>

Changes to accommodate the efficient definition and manipulation of big
records. It's not a pretty picture underneath, but the pretty-printer is
called on to make everything look as if nothing has changed.


# 4cd281d5 03-Sep-2002 Michael Norrish <Michael.Norrish@nicta.com.au>

Modify TypeBases so that they can store conversions as well as theorems
in a tyinfo's "simpls_of" slot. This is then used to implement a conversion
for enumerated type equalities. Previously, we just used a rewrite
directly, which meant that something of the form (x = C10) might turn
into the rather ugly (foo_to_num x = 11). Now, the rewrite is only
applied to equalities between constants.
Some comments in the .sig files in Datatype, RecordType and EnumType
hopefully also make it clearer what the weird string results are
doing, and how they get added into theory files.


# 52b22d6f 30-Jul-2002 Michael Norrish <Michael.Norrish@nicta.com.au>

Records now automatically prove one-one-ness result for literal syntax,
and this theorem is added as a simplification to the TypeBase.


# 3d907907 30-Jul-2002 Michael Norrish <Michael.Norrish@nicta.com.au>

Fix for bug when record fields involve option types (inducing a desire
in the code to have variables called "o"; which clashes with a constant
of the same name, which causes STRIP_TAC to pick other names for it,
breaking the tactics. Use of X_CHOOSE_THEN fixes that problem.


# 3f68081d 30-Jul-2002 Michael Norrish <Michael.Norrish@nicta.com.au>

Automatically prove some more theorems about records. It would be nice
to replace the "standard" cases/nchotomy theorem with the literal_nchotomy
one but the code in Datatype makes it look as if this would be quite
an undertaking (to do persistently at least).


# 3d2f9ce3 20-Jun-2001 Konrad Slind <konrad.slind@gmail.com>

Change stemming from split of TypeBase into TypeBasePure and TypeBase.


# 0e48bc5b 08-May-2001 Michael Norrish <Michael.Norrish@nicta.com.au>

Removed overloading on accessor functions so that field names are not
overloaded to them.


# cfdc1706 11-Apr-2001 Michael Norrish <Michael.Norrish@nicta.com.au>

Modifications caused by change of TypeBase signature.


# 77efd725 04-Feb-2001 Konrad Slind <konrad.slind@gmail.com>

New work aimed at making a single global EVAL function, with
an underlying compset.


# f5f89fe7 20-Nov-2000 Konrad Slind <konrad.slind@gmail.com>

Upgraded to build under Kan. 0.


# 71832c37 08-Nov-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

Made it all Kananaskis compatible. Datatype fails to load because of
something going wrong in loading pairTheory. This is BAD.


# 4d2aa2ca 19-Sep-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

More bug fixes. Bug found by Steve Brackin who had the temerity to call
a record type "r1" (!). Internal proofs within the package were failing
because GEN_TAC has the temerity to rename generalised variables that
are the names of existing constants, causing later steps in the proof to
go astray.


# 6a67b0f7 12-Sep-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

Bug report from Steve Brackin, a record type whose name started with x
resulted in a type error when something was being parsed. Fixed this
and also got the indentation right.


# 9f67e582 10-Jul-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

The function allow_for_overloading_on has been completely removed from
the system. The overload code now uses anti-unification of types to
figure out the least generalisation of all the types that an overloaded
operator needs to represent.


# 2bcd7391 18-Feb-2000 Konrad Slind <konrad.slind@gmail.com>

Small changes.


# e71e5d5f 09-Feb-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

Added definitions of functional updates to the simplification theorems
of a record type.


# 40325963 08-Feb-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

Updated to use Lib.gen_variant with tmvar_vary, which I prefer to the
loads-a-primes approach of the standard variant function.


# 4b043105 28-Jan-2000 Michael Norrish <Michael.Norrish@nicta.com.au>

Modified to cope with obscure bug. When creating the theorem to prove
for some of the theorems proved, this resulted in goals of the form
! X ... . <some term>
The letter X was chosen to be appropriate for the type. If the type's name
(chosen by the user) began with a capital K, then the letter chosen would be
K, the name of an existing constant. The tactic that attempted
to solve this goal came unstuck because the initial GEN_TAC resulted in
the bound variable X being renamed to X'. The tactic relied on the
name being correct, and failed as a result. But no more!


# 9d7cbc09 10-Dec-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Changes due to the incorporation of John Harrison's datatype definition
package.
In particular, record type definition is now done elsewhere, code here
just takes a tyinfo and proves all of the extra theorems (including some
definitions) appropriate for a record type.


# 58d28c77 16-Nov-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Fixed a bug when a record type had only one field.


# 689cd3cc 16-Nov-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Fairly wide-ranging modifications to make Hol_datatype take record type
definition quotations as well as normal types. The syntax supported is:
tyname = <| fld1 : ty1 ; fld2 : ty2 ; fld3 : ty3 ... |>
Not extensively tested.


# 8eb4ed1e 21-Oct-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Added proofs of two new useful theorems:
1. equality on records is equivalent to equality of fields, saved under
name rtype"_component_equality"
2. complete updates over any argument is equivalent to complete updates
over ARB, and hence to a "literal" record. Saved under the name
rtype"_updates_eq_literal"


# 0e8bd9e6 18-Oct-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Fixes in order to remove library file dependencies on global grammars.


# f4cafede 07-Sep-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Concrete syntax for records now very close to done. Thanks to Mark Staples
for suggesting that records with singleton updates could be done without
the brackets around the lists, thus: r with fld1 := 10.

Also proved the first of what will probably need to be a number of new
theorems giving fupd_ constants first class status (previously had
been rewriting them away).


# cb2ade16 03-Sep-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Definition function changed to give constants names with the type as a
prefix of the name. Definition also sets up overloading for record
concrete syntax.


# a0301e1d 27-Jul-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

When a record type is defined the simplification functions for that type
in the TypeBase are extended to include the update canonicalisation functions
and a variety of other relevant theorems.


# 2c9cc46f 06-Jul-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Modified to build on top of Datatype.Hol_datatype, thereby making sure that
records are properly recorded in the TypeBase.


# 58841e67 29-Apr-1999 Michael Norrish <Michael.Norrish@nicta.com.au>

Initial revision