theorem_proving_in_lean | Theorem proving in Lean
kandi X-RAY | theorem_proving_in_lean Summary
kandi X-RAY | theorem_proving_in_lean Summary
Theorem proving in Lean
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Writes a BeautifulSoup node
- Return a URI for the given code
theorem_proving_in_lean Key Features
theorem_proving_in_lean Examples and Code Snippets
Community Discussions
Trending Discussions on theorem_proving_in_lean
QUESTION
Trying to do the chapter 3 exercises in the lean documentation, but having a hard time understanding all the terminology as I know almost 0 about writing proofs. I want to learn more, but need some help.
I've just been trial and erroring trying to solve this example:
example : p ∨ q ↔ q ∨ p := sorry
not sure where to begin. Is there an answer key I'm missing with explanations?
...ANSWER
Answered 2020-May-15 at 16:43If the explanations in TPIL aren't helpful, then proposition world of the natural number game might be better https://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/. I have given a solution, but I'm not sure it will be that helpful if the explanations in TPIL aren't very helpful.
Here is a solution
QUESTION
The Lean documentation shows the following two examples with just a single variable:
from Theorem Proving in Lean: Existential Quantifiers: ...ANSWER
Answered 2020-Feb-28 at 23:57This works for me
QUESTION
I just read though the documentation of Lean, and try to do the 3.7. Exercises,
didn't finish all of them yet, but here are the first four exercises (without classical reasoning):
variables p q r : Prop
-- commutativity of ∧ and ∨
example : p ∧ q ↔ q ∧ p := sorry
example : p ∨ q ↔ q ∨ p := sorry-- associativity of ∧ and ∨
example : (p ∧ q) ∧ r ↔ p ∧ (q ∧ r) := sorry
example : (p ∨ q) ∨ r ↔ p ∨ (q ∨ r) := sorry
Here is what I did for that first four exercises:
...ANSWER
Answered 2019-Dec-24 at 07:34If you import Lean's math's library then the tactic by tauto!
should solve all of these. Additionally these are all already library theorems with names like and_comm
.
I don't think there are any shorter proofs of these statements from first principles. The only way you can shorten some of the proofs is by removing the have
s and show
s and making them less readable. Here's my proof of or_assoc
, which is essentially the same as yours, but without the have
s and show
s.
QUESTION
Section 3.6 of Theorem Proving in Lean shows the following:
...ANSWER
Answered 2019-Oct-19 at 14:44You don't have p ∨ q
in the assumptions of this example. So, you have to go from (assume hpqr, _)
directly to and_intro
. I mean, something like
QUESTION
Section 3.6 of Theorem Proving in Lean shows the following:
...ANSWER
Answered 2019-Oct-16 at 07:53Your approach, using the first method taught in Theorem Proving In Lean, is not really idiomatic in the sense that the code in Lean's maths library is either written in tactic mode (covered later on in the book) or in full term mode. Here's a tactic mode proof:
QUESTION
In Lean `choice' is implemented according to:
Our axiom of choice is now expressed simply as follows:
...ANSWER
Answered 2019-Mar-29 at 18:38The axiom choice
in Lean is indeed not the same as the axiom of choice
in set theory. The axiom choice
in Lean doesn't really have a corresponding statement in set theory. What is says is that there is a function which takes a proof that some type α
is nonempty, and produces an inhabitant of α
. In set theory, we cannot define functions which take proofs as arguments, since proofs are not objects in set theory, they are in the layer of logic on top of that.
That said, the two choice axioms are not completely unrelated. From Leans axiom choice
you can prove the more familiar axiom of choice from set theory, one version which you can find here.
QUESTION
I'm trying to understand inductive types from chapter 7 of "theorem proving in lean".
I set myself a task of proving that successor of natural numbers has a substitution property over equality:
...ANSWER
Answered 2018-Jul-16 at 10:55eq
is defined to be
QUESTION
I'm learning the Lean proof assistant. An exercise in https://leanprover.github.io/theorem_proving_in_lean/inductive_types.html is to define the predecessor function for the natural numbers. Can someone help me with that?
...ANSWER
Answered 2017-Oct-08 at 14:25You are probably familiar with pattern-matching from Lean or some functional programming language, so here is a solution that uses this mechanism:
QUESTION
I'm working through chapter 7 – Inductive Types of "Theorem Proving in Lean".
I'd like to know how to write the definition of dependent non-dependent product in a more expanded or "primitive" form.
It looks like the definition given in the tutorial automatically infers some detail:
inductive prod1 (α : Type u) (β : Type v) | mk : α → β → prod1
Some experimentation allows to fill in the detail
inductive prod2 (α : Type u) (β : Type v) : Type (max u v) | mk : α → β → prod2
However giving the definition in a fully expand form, using Pi types fails to typecheck:
inductive prod3 : Π (α : Type u) (β : Type v), Type (max u v) | mk : α → β → prod3
What is the correct way to write prod3
?
Finally, is the following definition equivalent to prod1
and prod2
, i.e. can the type checker always infer the correct type universe for α
and β
?
inductive prod4 (α : Type) (β : Type) | mk : α → β → prod4
ANSWER
Answered 2017-Jul-29 at 14:26First off, note that there is nothing dependent about your types. Dependent product is just another name for the Pi type itself (the Pi deriving from the usual mathematical notation for indexed products).
Your prod2
type is the correct maximally explicit version of prod1
. In prod3
, you changed α and β from inductive parameters to indices, which as you noticed doesn't work out for universe-related reasons. In general, indices are used to define inductive type families as in section 7.7.
Finally, the atomic Type
you used in prod4
is an abbreviation of Type 1
. You can use Type*
to have universe parameters inferred automatically.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install theorem_proving_in_lean
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page