Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup #126

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Katydid/Regex/IndexedRegex.lean
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def iso'' {P Q: Language.Lang α} (ifflang: ∀ {xs: List α}, P xs <-> Q xs) (r

-- | scalar {s: Type u}: (Decidability.Dec s) -> Lang P -> Lang (Language.scalar s P)
def onlyif {cond: Prop} (dcond: Decidable cond) (r: Regex α l): Regex α (Language.onlyif cond l) :=
-- TODO
sorry

def derive (r: Regex α l) (a: α): Regex α (Language.derive l a) :=
Expand All @@ -51,11 +52,13 @@ def derive (r: Regex α l) (a: α): Regex α (Language.derive l a) :=
| Regex.emptystr =>
iso Language.derive_emptystr Regex.emptyset
| Regex.pred p =>
-- TODO
-- iso Language.derive_pred (onlyif p Regex.emptystr)
sorry
| Regex.or x y =>
iso Language.derive_or (Regex.or (derive x a) (derive y a))
| Regex.concat x y =>
-- TODO
-- iso Language.derive_concat
-- (Regex.or
-- (onlyif (null x) (derive y a))
Expand Down
6 changes: 6 additions & 0 deletions Katydid/Regex/Language.lean
Original file line number Diff line number Diff line change
Expand Up @@ -651,24 +651,28 @@ theorem simp_and_null_l_emptystr_is_l
| And.intro hr hxs =>
exact hr
case mpr =>
-- TODO
sorry

theorem simp_and_emptystr_null_r_is_r
(r: Lang α)
(nullr: null r):
and emptystr r = r := by
-- TODO
sorry

theorem simp_and_not_null_l_emptystr_is_emptyset
(r: Lang α)
(notnullr: Not (null r)):
and r emptystr = emptyset := by
-- TODO
sorry

theorem simp_and_emptystr_not_null_r_is_emptyset
(r: Lang α)
(notnullr: Not (null r)):
and emptystr r = emptyset := by
-- TODO
sorry

theorem simp_and_idemp (r: Lang α):
Expand Down Expand Up @@ -755,12 +759,14 @@ theorem simp_and_not_emptystr_l_not_null_r_is_r
(r: Lang α)
(notnullr: Not (null r)):
and (not emptystr) r = r := by
-- TODO
sorry

theorem simp_and_not_null_l_not_emptystr_r_is_l
(r: Lang α)
(notnullr: Not (null r)):
and r (not emptystr) = r := by
-- TODO
sorry

theorem simp_one_r_implies_star_r (r: Lang α) (xs: List α):
Expand Down
3 changes: 3 additions & 0 deletions Katydid/Regex/SmartRegex.lean
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ theorem orToList_is_orFromList (x: Regex α):
orFromList (orToList x) = x := by
induction x <;> (try simp [orToList, orFromList])
· case or x1 x2 ih1 ih2 =>
-- TODO
sorry

-- 1. If x or y is emptyset then return the other (Language.simp_or_emptyset_r_is_l and Language.simp_or_emptyset_l_is_r)
Expand Down Expand Up @@ -352,6 +353,7 @@ def smartOr (x y: Regex α): Regex α :=

theorem smartOr_is_or (x y: Regex α):
denote (Regex.or x y) = denote (smartOr x y) := by
-- TODO
sorry

def derive (r: Regex α) (a: α): Regex α :=
Expand All @@ -370,6 +372,7 @@ def derive (r: Regex α) (a: α): Regex α :=

theorem derive_commutes {α: Type} (r: Regex α) (x: α):
denote (derive r x) = Language.derive (denote r) x := by
-- TODO
sorry

def derives (r: Regex α) (xs: List α): Regex α :=
Expand Down
22 changes: 3 additions & 19 deletions Katydid/Std/Lists.lean
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
-- Lean Tactics
-- https://leanprover.github.io/theorem_proving_in_lean4/tactics.html
-- Lean List Proofs
-- https://github.com/leanprover/std4/blob/main/Std/Data/List/Lemmas.lean
-- Coq List Proofs
-- This file is based on List Proofs originally done in Coq:
-- https://github.com/katydid/proofs/blob/old-coq/src/CoqStock/List.v
-- List of Lean Tactics
-- https://github.com/leanprover/lean4/blob/master/src/Init/Tactics.lean
-- Other Lean List Proofs can be found in:
-- https://github.com/leanprover/std4/blob/main/Std/Data/List/Lemmas.lean

import Mathlib.Tactic.Linarith
import Mathlib.Tactic.SplitIfs
Expand Down Expand Up @@ -1005,15 +1001,3 @@ theorem list_notin_cons (y: α) (x: α) (xs: List α):
apply h
apply Mem.tail
exact yinxs

theorem list_eraseReps_idemp {α: Type} [BEq α] (x: α) (xs: List α):
List.eraseReps (List.eraseReps xs) = List.eraseReps xs := by
sorry

theorem list_eraseReps_erases_first_rep {α: Type} [BEq α] (x: α) (xs: List α):
List.eraseReps (x::(x::xs)) = List.eraseReps (x::xs) := by
sorry

theorem list_eraseReps_does_not_erase_head (α: Type) [BEq α] [LawfulBEq α] (x: α) (xs: List α):
∃ (xs': List α), (x::xs') = List.eraseReps (x::xs) := by
sorry
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Optionally the following will also be helpful, but this is not required:
+ [Coq Lean Tactic Cheat Sheet](https://github.com/katydid/coq-lean-cheatsheet/)
+ [Lean Standard Libary Documentation](https://leanprover-community.github.io/mathlib4_docs/Std/Data/HashMap/Basic.html#Std.HashMap)
+ [Lean4 Meta Programming Book](https://github.com/arthurpaulino/lean4-metaprogramming-book)
+ [Tactic List](https://github.com/haruhisa-enomoto/mathlib4-all-tactics/blob/main/all-tactics.md)

Questions about Lean4 can be asked on [proofassistants.stackexchange](https://proofassistants.stackexchange.com/) by tagging questions with `lean` and `lean4` or in the [Zulip Chat](https://leanprover.zulipchat.com/).

Expand Down
Loading