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

Predicate support #656

Merged
merged 19 commits into from
Sep 28, 2024
Merged
Changes from 6 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
30 changes: 30 additions & 0 deletions SSA/Experimental/Bits/Fast/FiniteStateMachine.lean
Original file line number Diff line number Diff line change
Expand Up @@ -679,3 +679,33 @@ theorem decideIfZeros_correct {arity : Type _} [DecidableEq arity]
intro x s h
use x
exact h

inductive Predicate
( α : Type )
[ i : Fintype α ]
[ dec_eq : DecidableEq α ] :=
| eq (t1 t2 : Term )
tobiasgrosser marked this conversation as resolved.
Show resolved Hide resolved
| and (p q : Predicate α)
| or (p q : Predicate α)
| not (p : Predicate α)


def Predicate.denote
-- Why are `i` and `dec_eq` marked as unused?
(α : Type) [ i : Fintype α ] [ dec_eq : DecidableEq α ] :
Predicate α -> Prop
| eq t1 t2 => t1.eval = t2.eval
| and p q => p.denote ∧ q.denote
| or p q => p.denote ∨ q.denote
| not p => ¬ p.denote

-- write lowerings for predicates into FSMs
def Predicate.toFSM
(α : Type) [ i : Fintype α ] [ dec_eq : DecidableEq α ] :
Predicate α -> FSM α
| eq t1 t2 => (termEvalEqFSM (Term.xor t1 t2)).toFSM
| _ => sorry

theorem Predicate.toFsm_correct
(α : Type) [ i : Fintype α ] [ dec_eq : DecidableEq α ] (p : Predicate α) :
decideIfZeros p.toFSM = true ↔ p.denote := by sorry
Loading