Organizing constraints in isabelle in order to mod

2019-09-08 04:30发布

问题:

Suppose that I have the following expression in Isabelle/HOL:

typedecl Person
typedecl Car

consts age :: "Person ⇒ int" 
consts drives ::"(Person × Car) set"
consts owns ::"(Person × Car) set"

This is supposed to model Person and Car types with two relations between them, named drives and owns, and also the age property of Person.

I would like to state that everybody who owns a car, would definitely drive the car, and people who drive cars are greater than 17, So the constraints:

(∀a. a ∈ owns ⟶ a ∈ drives)
(∀d ∈ drives. age (fst d) > 17)

What is the best way to define these kind of constraints in Isabelle, in the sense that I can prove some properties over the model, assuming these constraints hold true?

回答1:

Setting aside things you might need to fix, such as that a (Person * Car) pair doesn't own or drive, you have two types, Person and Car which have no properties defined for them.

To give them properties, you need axioms, but you don't want to use something like axiomatization to define global axioms.

What you do to get some axiom action going is use type classes or locales. Someone else will want to fill in more details, but here's one bare-bones template:

typedecl Person
typedecl Car

locale foo_model =
  fixes age :: "Person => int" 
  fixes drives :: "(Person * Car) set"
  fixes owns :: "(Person * Car) set"
  assumes owns_axiom: "a ∈ owns --> a ∈ drives"
  assumes age_axiom: "∀d ∈ drives.  age (fst d) > 17"
begin
lemma some_lemma_you_want: "True"
  by(simp)
end

lemma (in foo_model) some_other_lemma_you_want : "True"
  by(simp)


标签: isabelle isar