lean

example: (p ∨ q) ∧ (p ∨ r) → p ∨ (q ∧ r)

纵然是瞬间 提交于 2021-02-10 20:25:12
问题 Section 3.6 of Theorem Proving in Lean shows the following: example : p ∨ (q ∧ r) ↔ (p ∨ q) ∧ (p ∨ r) := sorry Since this involves iff , let's demonstrate one direction first, left to right: example : p ∨ (q ∧ r) → (p ∨ q) ∧ (p ∨ r) := (assume h : p ∨ (q ∧ r), or.elim h (assume hp : p, show (p ∨ q) ∧ (p ∨ r), from ⟨or.inl hp, or.inl hp⟩) (assume hqr : q ∧ r, have hq : q, from hqr.left, have hr : r, from hqr.right, show (p ∨ q) ∧ (p ∨ r), from ⟨or.inr hq, or.inr hr⟩)) To go the other direction

example : ((p ∨ q) → r) → (p → r) ∧ (q → r)

蹲街弑〆低调 提交于 2020-02-06 07:39:52
问题 Section 3.6 of Theorem Proving in Lean shows the following: example : ((p ∨ q) → r) ↔ (p → r) ∧ (q → r) := sorry Let's focus on the left-to-right direction: example : ((p ∨ q) → r) → (p → r) ∧ (q → r) := sorry What's a good way to structure this example? If I go with something like this (with underscores used so that we can indicate the overall approach): example : ((p ∨ q) → r) → (p → r) ∧ (q → r) := (assume hpqr : (p ∨ q) → r, (assume hpq : p ∨ q, or.elim hpq (assume hp : p, show (p → r) ∧

From set inclusion to set equality in lean

Deadly 提交于 2019-12-24 09:39:38
问题 Given a proof of set inclusion and its converse I'd like to be able to show that two sets are equal. For example, I know how to prove the following statement, and its converse: open set universe u variable elem_type : Type u variable A : set elem_type variable B : set elem_type def set_deMorgan_incl : A ∩ B ⊆ set.compl ((set.compl A) ∪ (set.compl B)) := sorry Given these two inclusion proofs, how do I prove set equality, i.e. def set_deMorgan_eq : A ∩ B = set.compl ((set.compl A) ∪ (set.compl

Trouble defining a subset of Euclidean space

半腔热情 提交于 2019-12-13 17:51:22
问题 I am using Lean to try to formalize the notion of a subset of Euclidean space (R^n). I have tried the following: import analysis.real def repeated_prod : ℕ → Type → Type | 0 s := empty | 1 s := s | (n + 1) s := prod s (repeated_prod n s) structure euclidean_space (n : ℕ) : Type := (space : set (repeated_prod n ℝ)) def euclidean_subset (M : Type) := ∃ n : ℕ, (set M) ⊆ (euclidean_space.mk n).space To try putting in English: The real numbers (R) are defined in the analysis component of mathlib.

How to prove a = b → a + 1 = b + 1 in lean?

你离开我真会死。 提交于 2019-12-10 09:30:38
问题 I'm working my way through the chapter 4 of the lean tutorial. I'd like to be able to prove simple equalities, such as a = b → a + 1 = b + 1 without having to use the calc environment. In other words I'd like to explicitly construct the proof term of: example (a b : nat) (H1 : a = b) : a + 1 = b + 1 := sorry My best guess is that I need to use eq.subst and some relevant lemma about equality on natural numbers from the standard library, but I'm at loss. The closest lean example I can find is

Proving substitution property of successor over equality

我的梦境 提交于 2019-12-07 00:39:34
问题 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: inductive natural : Type | zero : natural | succ : natural -> natural lemma succ_over_equality (a b : natural) (H : a = b) : (natural.succ a) = (natural.succ b) := sorry After some guesswork and fairly exhaustive search I was able to satisfy the compiler with a couple of possibilities: lemma succ_over

How to prove a = b → a + 1 = b + 1 in lean?

馋奶兔 提交于 2019-12-05 15:54:45
I'm working my way through the chapter 4 of the lean tutorial . I'd like to be able to prove simple equalities, such as a = b → a + 1 = b + 1 without having to use the calc environment. In other words I'd like to explicitly construct the proof term of: example (a b : nat) (H1 : a = b) : a + 1 = b + 1 := sorry My best guess is that I need to use eq.subst and some relevant lemma about equality on natural numbers from the standard library, but I'm at loss. The closest lean example I can find is this: example (A : Type) (a b : A) (P : A → Prop) (H1 : a = b) (H2 : P a) : P b := eq.subst H1 H2 While

Why haven't newer dependently typed languages adopted SSReflect's approach?

最后都变了- 提交于 2019-12-03 04:14:57
问题 There are two conventions I've found in Coq's SSReflect extension that seem particularly useful but which I haven't seen widely adopted in newer dependently-typed languages (Lean, Agda, Idris). Firstly, where possible predicates are expressed as boolean-returning functions rather than inductively defined datatypes. This brings decidability by default, opens up more opportunities for proof by computation, and improves checking performance by avoiding the need for the proof engine to carry

Why haven't newer dependently typed languages adopted SSReflect's approach?

对着背影说爱祢 提交于 2019-12-02 17:33:52
There are two conventions I've found in Coq's SSReflect extension that seem particularly useful but which I haven't seen widely adopted in newer dependently-typed languages (Lean, Agda, Idris). Firstly, where possible predicates are expressed as boolean-returning functions rather than inductively defined datatypes. This brings decidability by default, opens up more opportunities for proof by computation, and improves checking performance by avoiding the need for the proof engine to carry around large proof terms. The main disadvantage I see is the need to use reflection lemmas to manipulate