Skip to content

Commit b7c22e8

Browse files
committed
propositional logic
1 parent 70859cd commit b7c22e8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Inhabit/Logic/Prop.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Syntax
2+
inductive PropLang where
3+
| Var (name : String)
4+
| Not (a : PropLang)
5+
| And (a b : PropLang)
6+
| Or (a b : PropLang)
7+
8+
-- Semantics
9+
abbrev PropInterp := String → Bool
10+
11+
def List.interp (l : List String) : PropInterp := l.contains
12+
13+
def prop_eval (f : PropLang) (i : PropInterp) : Bool :=
14+
match f with
15+
| .Var name => i name
16+
| .Not a => not (prop_eval a i)
17+
| .And a b => and (prop_eval a i) (prop_eval b i)
18+
| .Or a b => or (prop_eval a i) (prop_eval b i)

0 commit comments

Comments
 (0)