isabelle

Applying axioms about Sequents

别来无恙 提交于 2019-12-24 19:44:21
问题 Consider the following minimal development based on the Isabelle Sequents library: theory Test imports Pure Sequents.Sequents begin syntax "_Trueprop" :: "two_seqe" ("((_)/ ⊢ (_))" [6,6] 5) consts Trueprop :: two_seqi parse_translation ‹[ (@{syntax_const "_Trueprop"}, K (two_seq_tr @{const_syntax Trueprop})) ]› print_translation ‹[ (@{const_syntax Trueprop}, K (two_seq_tr' @{syntax_const "_Trueprop"})) ]› axiomatization where identity : "$A, P, $B ⊢ $C, P, $D" and xch : "$A, $B, $C, $D, $E ⊢

How can I prove the lemma in Exercise 4.6 in “Programming and Proving in Isabelle/HOL”?

扶醉桌前 提交于 2019-12-24 17:22:07
问题 I am trying to solve Exercise 4.6 in “Programming and Proving in Isabelle/HOL”. It asks to define a function elems :: "'a list ⇒ 'a set" that converts a list into a set, and to prove the lemma "x ∈ elems xs ⟹ ∃ ys zs . xs = ys @ x # zs ∧ x ∉ elems ys" . Until now, I have come that far: fun elems :: "'a list ⇒ 'a set" where "elems [] = {}" | "elems (x # xs) = {x} ∪ elems xs" lemma first_occ: "x ∈ elems xs ⟹ ∃ ys zs . xs = ys @ x # zs ∧ x ∉ elems ys" proof (induction xs) case Nil thus ?case by

Isabelle's Code generation: Abstraction lemmas for containers?

馋奶兔 提交于 2019-12-24 14:12:39
问题 I am experimenting with the Code generator. My theory contains a datatype that encodes an invariant: typedef small = "{x::nat. x < 10}" morphisms to_nat small by (rule exI[where x = 0], simp) definition "is_one x ⟷ x = small 1" Now I want to export code for is_one . It seems that I first have to set up the data type for the code generator as follows: code_datatype small instantiation small :: equal begin definition "HOL.equal a b ⟷ to_nat a = to_nat b" instance apply default unfolding equal

Error message in Isabelle/HOL

☆樱花仙子☆ 提交于 2019-12-24 12:19:05
问题 When applying the wrong tactic or the wrong deduction rule, the error message is usually too general: Failed to apply initial proof method⌂ I am using Isabelle to teach natural deduction. When Isabelle complains, some students change the rule/tactic arbitrary without reflecting on the possible causes of the error. A more detailed error message could be part of the learning process of Isabelle, I think. How to make those error messages student friendly? Does that require editing the source

Failed to refine any pending goal

让人想犯罪 __ 提交于 2019-12-24 11:44:33
问题 I am trying to prove a theorem in Isabelle and I am stuck in this step: theorem exists_prime_factor: " (n > Suc 0) ⟶ (∃xs::nat list. prod_list xs = n ∧ all_prime xs)" proof (induct n rule: less_induct) case (less k) assume HI: "⋀y::nat. (y < k ⟹ Suc 0 < y ⟶ (∃xs. prod_list xs = y ∧ all_prime xs))" then show ?case proof - show "(Suc 0 < k) ⟶ (∃xs. prod_list xs = k ∧ all_prime xs)" proof - assume "Suc 0 < k" then show "(∃xs. prod_list xs = k ∧ all_prime xs)" sorry In the last goal I need to

How to simplify an inductive predicate by evaluation?

做~自己de王妃 提交于 2019-12-24 10:57:18
问题 I defined a very simple object-oriented model. The model defines a set of classes and a set of associations. nonterminal fmaplets and fmaplet syntax "_fmaplet" :: "['a, 'a] ⇒ fmaplet" ("_ /↦⇩f/ _") "_fmaplets" :: "['a, 'a] ⇒ fmaplet" ("_ /[↦⇩f]/ _") "" :: "fmaplet ⇒ fmaplets" ("_") "_FMaplets" :: "[fmaplet, fmaplets] ⇒ fmaplets" ("_,/ _") "_FMapUpd" :: "['a ⇀ 'b, fmaplets] ⇒ 'a ⇀ 'b" ("_/'(_')" [900, 0] 900) "_FMap" :: "fmaplets ⇒ 'a ⇀ 'b" ("(1[_])") syntax (ASCII) "_fmaplet" :: "['a, 'a] ⇒

How to prove lemmas for mutually recursive types?

╄→гoц情女王★ 提交于 2019-12-24 08:19:07
问题 Here is a sample theory: datatype t1 = A | B t2 and t2 = C | D t1 inductive rel1 and rel2 where "rel1 A 0" | "rel2 x n ⟹ rel1 (B x) n" | "rel2 C 1" | "rel1 x n ⟹ rel2 (D x) n" lemma rel1_det: "rel1 x n ⟹ rel1 x m ⟹ n = m" apply (induct x, auto) apply (simp add: rel1.simps) apply (simp add: rel1.simps) I'm trying to prove, that rel1 is deterministic. But it seems that I can't use a simple induction. Could you suggest what tactics to use to prove such lemmas? 回答1: For mutually dependent types,

Convert an Isar proof of forall-statement to apply-style

心不动则不痛 提交于 2019-12-24 08:03:23
问题 I'm trying to build a very short proof for a given fact. I would like to just use apply-style commands. Now my theorem's structure looks like this: theorem statement apply(some commands) proof - fix t assume "some predicate" from some assumptions "some_theorem" by(some commands) qed So, if I want to do my proof minimal, I should really attack the lines: fix t assume "some predicate" from some assumptions "some_theorem" which is basically implementing the proof of a forall statement: ⋀ param.

Isabelle Real Datatype - Malformed definition: Non-constructor pattern not allowed in sequential mode

社会主义新天地 提交于 2019-12-24 05:59:36
问题 I am creating a function of the form y(t+h) = y(t) + h/y(t) where y(0) = 1 fun y :: "real ⇒ real" where "y 0 = Suc(0)"| "y(t+h) = y(t) + h*(1/y(t))" Unfortunately, I am getting an error Malformed definition: Non-constructor pattern not allowed in sequential mode. y 0 = real (Suc 0) Googling showed me that I am not adhering to some constructor pattern of real datatype but I am not able to find what the pattern is and how I should change my function. 回答1: Real numbers are not an algebraic

How can I pass a ML value as an argument to an outer syntax command?

假装没事ソ 提交于 2019-12-24 00:58:17
问题 I define an outer syntax command, imake to write some code to a file and do some other things. The intended usage is as follows: theory Scratch imports Complex_Main "~/Is0/IsS" begin imake ‹myfile› end The above example will write some contents to the file myfile . myfile should be a path relative to the location of the Scratch theory. ML ‹val this_path = File.platform_path(Resources.master_directory @{theory}) I would like to be able to use the value this_path in specifying myfile . The