test: experiment

This commit is contained in:
Leonardo de Moura 2021-03-04 14:48:49 -08:00
parent fe94731779
commit 2b78de650a

33
tests/playground/nnf.lean Normal file
View file

@ -0,0 +1,33 @@
open Lean
partial def mkBigAnd (n : Nat) (p : Syntax) : MacroM Syntax :=
loop 0 n
where
loop (low high : Nat) : MacroM Syntax := do
if low == high then
`($p[$(quote low)])
else
let mid := (low + high)/2
`($(← loop low mid) ∧ $(← loop (mid + 1) high))
macro "bigAnd! " n:num p:ident : term => mkBigAnd n.toNat p
partial def mkBigOrNot (n : Nat) (p : Syntax) : MacroM Syntax :=
loop 0 n
where
loop (low high : Nat) : MacroM Syntax := do
if low == high then
`(¬ $p[$(quote low)])
else
let mid := (low + high)/2
`($(← loop low mid) $(← loop (mid + 1) high))
macro "bigOrNot! " n:num p:ident : term => mkBigOrNot n.toNat p
@[simp] axiom not_and (p q : Prop) : (¬ (p ∧ q)) = (¬ p ¬ q)
theorem ex (p : Array Prop) : (¬ bigAnd! 500 p) = bigOrNot! 500 p := by
simp only [not_and]
rfl
-- #print ex