190 likes | 312 Views
This document explores the concepts of declaring sets and variables in the context of a student and library management system. It provides examples such as defining a "Student" set and the "Book" and "Person" sets in a library management system. It explains the assignment of names to types upon declaration and illustrates variables through examples, including the relationship between books and their copies. Also covered are syntactic equivalence, enumerated types, and axiomatic descriptions for introducing variables with predicates.
E N D
Given sets : examples • To introduce declaration of a set of student ; [ student ] • In a library management system, the type Book and Person can be introduced as given sets : [ Book, Person ]
Declaration of variables • A name is assigned a type when it is declared. Once a given set is declared, we can declare variables. • Example stud1 : Student --- declaring a student library1 : pBook --- declaring a set of books primes : p --- declaring primes to be a set of integers newestbook : Book --- what the book is and a number showing the copy library : p(Book ) --- declaring a library as a set of copies of books
Abbreviations • Syntactic equivalence • Example basic_ref == {math, intro_to_computers} • Is equivalent to the declaration basic_ref : p Book together with the predicate basic_ref = {math, intro_to_computers}
Enumerated types • Use data type definition to introduce a type with a small number of members • Name ::= list of elements separated by | • Example YesNo ::= yes | no
Axiomatic description • To introduce variables along with predicates giving further information