Definition of an unbundled union of different types in Isabel and more

I asked a series of questions to understand that I could define the next simple model in Isabel, but I still stuck to what I wanted. I will try to briefly describe the problem with an example:

Example:

Suppose I have two classes Person and Car, Person owns cars and also drives cars. Therefore, I need the following types / sets:

Person

Car

belongs (* belongs to Person to Car * elements)

wheels (* wheels also apply to Person elements for a car *)

Problem:

I would like to formulate the above example in Isabelle - this is a way that provides the following flexibility:

  • ; : , . , .

  • /, C, Car . - , . - , ?

  • (2); , /, D, C .

(2) (3) / /; , Person (. ), , C , C, - Person. , o1 - C, , ( Person) (Car), o1.

.

0
1

Isabelle/HOL , 'a + 'b, . :

Inl :: 'a => 'a + 'b

Inr :: 'b => 'a + 'b

. , , , nat list nat, (nat list) + nat. length :: 'a list => nat, , , . ( , , , ), .

, , , .

fun maybe_length :: "(nat list) + nat => nat"
where
  "maybe_length (Inl xs) = length xs" |
  "maybe_length (Inr n) = n"
+1

All Articles