Organizing constraints in isabelle in order to model a system

寵の児 提交于 2019-12-13 04:59:03

问题


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)


来源:https://stackoverflow.com/questions/26788396/organizing-constraints-in-isabelle-in-order-to-model-a-system

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!