Welcome to the TLA+ community! I indeed believe that the properties that you are interested in are best verified in a refinement style where the high-level specification "obviously" enforces the conditions (along the lines of the spec that you included in your message), and then verify that a lower-level description of the actual system implies the higher-level spec. The write-through cache example in chapter 5 of Specifying Systems follows this strategy. A few remarks about the spec that you sent: - SectorBytes could be an operator or a function. It doesn’t make a huge difference, but when in doubt, I’d rather use an operator. - The definition of ByteRange is short and the operator is only used at a single place of the spec, you may consider inlining it. - The second property asserts that "A flash location may not be written more than once without an interposed erase". This condition is ensured by two guards in the Write action: first you require that all relevant sectors have a state different from "unknown", then that Programmed \cap Bytes = {}. I believe indeed that this ensures what you want because I think that you have the invariant \A s \in Sectors : SectorBytes[s] \cap Programmed # {} => SectorState[s] = "programmed" which (together with the type invariant) implies that the relevant sectors must have been erased, but why not make it more explicit by replacing the two guards by \A s \in WriteSectors : SectorState[s] = "erased" in the definition of Write? (And in fact this change would make it obvious that both properties of interest are ensured by the high-level specification.) Perhaps one could even get rid of the variable Programmed and let the high-level spec exclusively focus on sectors, given that this is the only concept that appears in the properties that you describe. My 2 cents, Stephan
You received this message because you are subscribed to the Google Groups "tlaplus" group. To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx. To view this discussion visit https://groups.google.com/d/msgid/tlaplus/499192C6-1B11-4412-884A-A0328E968CB6%40gmail.com. |