Skip to content

Commit

Permalink
finish inject_never_containsDag using Formula.rec
Browse files Browse the repository at this point in the history
  • Loading branch information
m4lvin committed Oct 23, 2023
1 parent 5300cfa commit 94fcbd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
1 change: 1 addition & 0 deletions Pdl/Examples.lean
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ example (a b : Program) (X : Formula) :
by
unfold semEquiv
intro W M w
simp
sorry

theorem last_snoc {m b} {ys : Vector α m} : b = last (snoc ys b) :=
Expand Down
39 changes: 16 additions & 23 deletions Pdl/Unravel.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inductive DagFormula : Type
| and : DagFormula → DagFormula → DagFormula
| box : Program → DagFormula → DagFormula
| dag : Program → DagFormula → DagFormula
deriving Repr -- DecidableEq is not derivable here?
deriving Repr

local notation "·" c => DagFormula.atom_prop c
local prefix:11 "~" => DagFormula.neg
Expand Down Expand Up @@ -45,9 +45,6 @@ def inject : Formula → DagFormula
| φ⋀ψ => inject φ ⋀ inject ψ
| ⌈α⌉φ => ⌈α⌉(inject φ)

-- instance : Coe Formula DagFormula := ⟨inject⟩ -- nope
-- read https://leanprover-community.github.io/mathlib4_docs/Init/Coe.html

-- | Borzechowski's f function, sort of.
@[simp]
def containsDag : DagFormula → Bool
Expand All @@ -73,30 +70,26 @@ lemma undag_inject {f} : undag (inject f) = f :=
apply undag_inject

@[simp]
lemma inject_never_containsDag f : ¬ containsDag (inject f) :=
lemma inject_never_containsDag : ∀ f, containsDag (inject f) = false :=
by
cases f
apply Formula.rec
case bottom => simp
case atom_prop => simp
case neg f =>
apply inject_never_containsDag
case and f g =>
have := inject_never_containsDag f
have := inject_never_containsDag g
simp [containsDag]
tauto
case box _ f =>
case neg =>
intro f
simp
case and =>
intro g h
simp [containsDag]
have := inject_never_containsDag f
simp at this
tauto
termination_by
inject_never_containsDag => lengthOfFormula f -- maybe bad, because it counts α from box too
decreasing_by
simp at *
-- TODO
-- read https://github.com/leanprover/theorem_proving_in_lean4/blob/master/induction_and_recursion.md
sorry
case box =>
intro a f
simp
-- The recursor introduces program cases which we do not care about.
case motive_2 =>
intro _
exact True
all_goals { simp }

-- MEASURE
@[simp]
Expand Down

0 comments on commit 94fcbd9

Please sign in to comment.