Skip to content

Commit

Permalink
now build all files again
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Aug 23, 2024
1 parent 9133c58 commit 94ce085
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 30 deletions.
3 changes: 3 additions & 0 deletions Katydid.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import Katydid.Std.Balistic

import Katydid.Example.SimpLibrary

import Katydid.Expr.Desc
import Katydid.Expr.Regex

import Katydid.Conal.Language
import Katydid.Conal.LanguageNotation
import Katydid.Conal.Calculus
Expand Down
9 changes: 6 additions & 3 deletions Katydid/Expr/Desc.lean
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Std.Data.List.Lemmas
import Std.Classes.Order
import Katydid.Std.Lists

/-
We want to represent some nested function calls for a very restricted language, for example:
and(lt(3, 5), contains("abcd", "bc"))
We represent the description (including AST) of the expr, or as we call it the Descriptor here:
-/

namespace Desc

inductive Desc where
| intro
(name: String)
Expand Down Expand Up @@ -227,5 +228,7 @@ theorem cmp_symm : ∀ (x y : SmartDesc),
-- TODO
sorry

instance : Std.OrientedCmp SmartDesc.compare where
instance : Batteries.OrientedCmp SmartDesc.compare where
symm x y := cmp_symm x y

end Desc
58 changes: 31 additions & 27 deletions Katydid/Expr/Regex.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Lean
open List

namespace Regex

inductive Regex : Type where
| emptyset : Regex
| emptystr : Regex
Expand Down Expand Up @@ -53,56 +55,58 @@ partial def elabRegex : Lean.Syntax → Lean.Meta.MetaM Lean.Expr

elab " {{ " e:regex " }} " : term => elabRegex e

#check {{ ∅ }}
example: Regex := {{ ∅ }}

example: Regex := {{ 'a' }}

#check {{ 'a' }}
example: Regex := {{ a }}

#check {{ a }}
example: Regex := {{ abc }}

#check {{ abc }}
example: Regex := {{ 'a''b''c' }}

#check {{ 'a''b''c' }}
example: Regex := {{ "" }}

#eval {{ "" }}
example: Regex := {{ a }}

#eval {{ a }}
example: Regex := {{ "a" }}

#eval {{ "a" }}
example: Regex := {{ ab }}

#eval {{ ab }}
example: Regex := {{ "ab" }}

#eval {{ "ab" }}
example: Regex := {{ abc }}

#eval {{ abc }}
example: Regex := {{ "abc" }}

#eval {{ "abc" }}
example: Regex := {{ abc }}

#check {{ abc }}
example: Regex := {{ "abc" }}

#check {{ "abc" }}
example: Regex := {{ ε }}

#check {{ ε }}
example: Regex := {{ 'a' }}

#eval {{ 'a' }}
example: Regex := {{ a }}

#check {{ a }}
example: Regex := {{ 'a' | 'b' }}

#check {{ 'a' | 'b' }}
example: Regex := {{ ab }}

#check {{ ab }}
example: Regex := {{ a b }}

#check {{ a b }}
example: Regex := {{ a b c }}

#check {{ a b c }}
example: Regex := {{ a* }}

#eval {{ a* }}
example: Regex := {{ (a)* }}

#eval {{ (a)* }}
example: Regex := {{ "a"* }}

#eval {{ "a"* }}
example: Regex := {{ ("a")* }}

#eval {{ ("a")* }}
example: Regex := {{ (a)(b) }}

#eval {{ (a)(b) }}
example: Regex := {{ (a | b)* }}

#eval {{ (a | b)* }}
end Regex

0 comments on commit 94ce085

Please sign in to comment.