isabelle

How to define Subtypes in Isabelle and what they mean?

北城余情 提交于 2019-12-12 01:58:36
问题 The question regarding subtyping in Isabelle is very lengthy here. So my simple question is that how I can define type B to be a subtype of A if I define A as below: typedecl A By doing this I would like to make all operations and relations defined over A (they are not printed here) accessible to elements of type B. A bit more complex example is to define B and C to be subtype of A such that B and C are disjoint, and every element of A is either of type B or of type C. Thanks 回答1: Isabelle

Defining disjoint union of different types in Isabelle and more

孤者浪人 提交于 2019-12-11 16:46:20
问题 I asked a series of question to get to the point I can define the following simple model in Isabelle, But I still stuck in getting what I wanted. I try to very briefly describe the problem with an example: Example: Suppose I have two classes Person and Car , Person owns cars and also drives cars. So I need the following types/sets: Person Car owns (* owns relates elements of Person to Car *) drives (* drives relate elements of Person to car as well *) Problem: I would like to formulate above

How to merge set of finite maps?

岁酱吖の 提交于 2019-12-11 15:27:44
问题 I can merge two finite maps as follows: value "fmadd (fmap_of_list [(1::nat,2::nat)]) (fmap_of_list [(2::nat,3::nat)])" But when I try to merge a set of maps: value "ffold fmadd fmempty {| fmap_of_list [(1::nat,2::nat)], fmap_of_list [(2::nat,3::nat)]|}" I get the following error: Wellsortedness error: Type nat ⇀⇩f nat not of sort finite No type arity fmap :: finite According to definition of fmap , it's domain is finite: typedef ('a, 'b) fmap = "{m. finite (dom m)} :: ('a ⇀ 'b) set"

Substitution in Isabelle

*爱你&永不变心* 提交于 2019-12-11 13:36:15
问题 In many paper proofs you see authors substitute variables in equations. For example, if there is an inequality "f(x-y) >= g(x-y)*z, the author simply writes let h=(x-y), therefore "f(h) >= g(h)*z" and continues with the proof. To do the same in Isabelle, would I have to assume that h=(x-y), is there some other way of doing it? I looked at the "let" feature however that does something completely different. Specifically, I have: lemma fixes f g :: "real⇒real" assumes "∀x∈S. ∀y∈S. f y - f x ≥ (y

Inductive Set with Non-fixed Parameters

一个人想着一个人 提交于 2019-12-11 11:38:16
问题 When defining an inductive predicate I can choose which parameters are fixed and which not. For a contrived example consider: inductive foo for P where "foo P True (Inl x) (Inl x)" Is it somehow possible to turn this into an inductively defined set with one fixed and one non-fixed parameter? inductive_set Foo for P where "(Inl x, Inl x) : Foo P True" is rejected with the error message: Argument types 'd, bool of Foo do not agree with types'd of declared parameter I know that I can define a

Function to double a list in Isabelle

社会主义新天地 提交于 2019-12-11 09:11:55
问题 I would like to define a function in Isabelle/HOL that doubles a list fun double :: "'a list => 'a list" where ... such that double [x1, x2, ...] = [x1, x1, x2, x2, ...] I have tried the following: fun double :: " 'a list ⇒ 'a list" where "double [] = []" | "double [x#[l]] = x # x # double [l]" as well as some other definitions. I get the error Type unification failed Type error in application: incompatible operand type What is wrong with my function? 回答1: Actually the error message contains

Intro rule for “∀r>0” in Isabelle

£可爱£侵袭症+ 提交于 2019-12-11 08:09:36
问题 When I have a goal such as "∀x. P x" in Isabelle, I know that I can write show "∀x. P x" proof (rule allI) However, when the goal is "∀x>0. P x" , I cannot do that. Is there a similar rule/method that I can use after proof in order to simplify my goal? I would also be interested in one for the situation where you have a goal of the form "∃x>0. P x" . I'm looking for an Isar proof that uses the proof (rule something) style. 回答1: Universal quantifier To expand on Lars's answer: ∀x>0. P x is

How can I efficiently prove existential propositions with multiple variables in Isabelle/Isar?

自闭症网瘾萝莉.ら 提交于 2019-12-11 07:30:17
问题 Say I want to prove the lemma ∃ n m k . [n, m, k] = [2, 3, 5] in Isabelle/Isar. If I go ahead as suggested in the Isabelle/HOL tutorial on page 45, my proof looks as follows: lemma "∃ n m k . [n, m, k] = [2, 3, 5]" proof show "∃ m k . [2, m, k] = [2, 3, 5]" proof show "∃ k . [2, 3, k] = [2, 3, 5]" proof show "[2, 3, 5] = [2, 3, 5]" by simp qed qed qed Of course, this is way too verbose. How can I prove propositions like the above one such that the proofs are concise and readable? 回答1:

What is the syntax to use Map.thy

邮差的信 提交于 2019-12-11 04:59:07
问题 So far I can define a map map_of [(1, 2), (3, 4::int)] of type 'a => int option When I try to get the domain of the map: dom (map_of [(1, 2), (3, 4::int)]) give the error Wellsortedness error: Type 'b not of sort enum Cannot derive subsort relation {equal,numeral} < enum The examples in Enum.thy only show finite cases, how do you prove the enum property for an infinite type like int or nat? Update 1: Fixed the syntax and give the exact error message 回答1: This looks like a problem that occurs

How to fix “Illegal schematic variable(s)” in mutually recursive rule induction?

两盒软妹~` 提交于 2019-12-10 22:45:42
问题 In Isabelle, I'm trying to do rule induction on mutually recursive inductive definitions. Here's the simplest example I was able to create: theory complex_exprs imports Main begin datatype A = NumA int | AB B and B = NumB int | BA A inductive eval_a :: "A ⇒ int ⇒ bool" and eval_b :: "B ⇒ int ⇒ bool" where eval_num_a: "eval_a (NumA i) i" | eval_a_b: "eval_b b i ⟹ eval_a (AB b) i" | eval_num_b: "eval_b (NumB i) i" | eval_b_a: "eval_a a i ⟹ eval_b (BA a) i" lemma foo: assumes "eval_a a result"