diff -r 69032a618aa9 -r d14c4e9e9c8e src/HOL/MicroJava/J/WellForm.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/MicroJava/J/WellForm.thy Thu Nov 11 12:23:45 1999 +0100 @@ -0,0 +1,47 @@ +(* Title: HOL/MicroJava/J/WellForm.thy + ID: $Id$ + Author: David von Oheimb + Copyright 1999 Technische Universitaet Muenchen + +Well-formedness of Java programs +for static checks on expressions and statements, see WellType.thy + +improvements over Java Specification 1.0 (cf. 8.4.6.3, 8.4.6.4, 9.4.1): +* a method implementing or overwriting another method may have a result type + that widens to the result type of the other method (instead of identical type) + +simplifications: +* for uniformity, Object is assumed to be declared like any other class +*) + +WellForm = TypeRel + + +types 'c wtm = 'c prog => cname => 'c mdecl => bool + +constdefs + + wf_fdecl :: "'c prog \\ fdecl \\ bool" +"wf_fdecl G \\ \\(fn,ft). is_type G ft" + + wf_mhead :: "'c prog \\ sig \\ ty \\ bool" +"wf_mhead G \\ \\(mn,pTs) rT. (\\T\\set pTs. is_type G T) \\ is_type G rT" + + wf_mdecl :: "'c wtm \\ 'c wtm" +"wf_mdecl wtm G C \\ \\(sig,rT,mb). wf_mhead G sig rT \\ wtm G C (sig,rT,mb)" + + wf_cdecl :: "'c wtm \\ 'c prog \\ 'c cdecl \\ bool" +"wf_cdecl wtm G \\ + \\(C,(sc,fs,ms)). + (\\f\\set fs. wf_fdecl G f ) \\ unique fs \\ + (\\m\\set ms. wf_mdecl wtm G C m) \\ unique ms \\ + (case sc of None \\ C = Object + | Some D \\ + is_class G D \\ \\ G\\D\\C C \\ + (\\(sig,rT,b)\\set ms. \\D' rT' b'. + cmethd(G,D) sig = Some(D',rT',b') \\ G\\rT\\rT'))" + + wf_prog :: "'c wtm \\ 'c prog \\ bool" +"wf_prog wtm G \\ + let cs = set G in ObjectC \\ cs \\ (\\c\\cs. wf_cdecl wtm G c) \\ unique G" + +end