Skip to content

Commit

Permalink
Revert "Merge branch 'main' into equations-command-modification"
Browse files Browse the repository at this point in the history
This reverts commit a3cf909, reversing
changes made to fd25f3f.
  • Loading branch information
0art0 committed Oct 8, 2024
1 parent a3cf909 commit f0eabb9
Show file tree
Hide file tree
Showing 76 changed files with 198 additions and 486 deletions.
1 change: 0 additions & 1 deletion .github/workflows/blueprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ jobs:
- name: Generate home_page/implications/implications.js
run: |
~/.elan/bin/lake exe extract_implications outcomes > /tmp/out.json
pip install markdown
python scripts/generate_equation_implication_js.py /tmp/out.json
- name: Bundle dependencies
Expand Down
9 changes: 7 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
// Learn about workspace recommendations at:
// https://go.microsoft.com/fwlink/?LinkId=827846

// The extension identifier format is ${publisher}.${name}
// Example: vscode.csharp

// List of extensions that should be recommended for users of this workspace
"recommendations": [
"leanprover.lean4", // Extension for Lean 4 support
"James-Yu.latex-workshop" // LaTeX Workshop extension for LaTeX support
"leanprover.lean4" // Extension for Lean 4 support
]
}
5 changes: 0 additions & 5 deletions blueprint/.vscode/settings.json

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation1.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation14.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation1571.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation168.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation1689.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation2.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation26302.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation28770.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation345169.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation3588.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation374794.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation381.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation387.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation43.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation4512.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation46.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation477.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation5105.md

This file was deleted.

2 changes: 0 additions & 2 deletions commentary/Equation65.md

This file was deleted.

142 changes: 0 additions & 142 deletions equational_theories/EquationLawConversion.lean

This file was deleted.

36 changes: 2 additions & 34 deletions equational_theories/EquationsCommand.lean
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
import Lean
import equational_theories.Magma
import equational_theories.MagmaLaw
import equational_theories.EquationLawConversion

open Lean Elab Command Law

def mkNatMagmaLaw (declName : Name) : ImportM NatMagmaLaw := do
let { env, opts, .. } ← read
IO.ofExcept <| unsafe env.evalConstCheck NatMagmaLaw opts ``NatMagmaLaw declName

initialize magmaLawExt : PersistentEnvExtension Name (Name × NatMagmaLaw) (Array (Name × NatMagmaLaw)) ←
registerPersistentEnvExtension {
mkInitial := pure .empty
addImportedFn := Array.concatMapM <| Array.mapM <| fun n ↦ do return (n, ← mkNatMagmaLaw n)
addEntryFn := Array.push
exportEntriesFn := .map Prod.fst
}

def getMagmaLaws {M} [Monad M] [MonadEnv M] : M (Array (Name × NatMagmaLaw)) := do
return magmaLawExt.getState (← getEnv)
open Lean Elab Command

/--
For a more concise syntax, but more importantly to speed up elaboration (where type inference
Expand All @@ -29,10 +13,7 @@ elab mods:declModifiers tk:"equation " i:num " := " tsyn:term : command => do
let G := mkIdent (← MonadQuotation.addMacroScope `G)
let inst := mkIdent (← MonadQuotation.addMacroScope `inst)
let eqName := mkIdent (.mkSimple s!"Equation{i.getNat}")
let finLawName := mkIdent (.mkSimple s!"FinLaw{i.getNat}")
let lawName := mkIdent (.mkSimple s!"Law{i.getNat}")
let finThmName := mkIdent (.str finLawName.getId "models_iff")
let thmName := mkIdent (.str lawName.getId "models_iff")
let mut is := #[]
let t := tsyn.raw
-- Collect all identifiers to introduce them as parameters
Expand Down Expand Up @@ -60,20 +41,7 @@ elab mods:declModifiers tk:"equation " i:num " := " tsyn:term : command => do
| some idx => `(FreeMagma.Leaf $(quote idx.val))
| none => pure s
let mut tl : Term := ⟨tl⟩
let freeMagmaSize := Syntax.mkNumLit (toString is.size)
-- define law over `Fin n`
elabCommand (← `(command| abbrev%$tk $finLawName : Law.MagmaLaw (Fin $freeMagmaSize) := $tl))
-- compatibility between the `finLaw` and the original equation
let modelsIffLemma : Ident := mkIdent (.mkSimple s!"models_iff_{is.size}")
elabCommand (← `(command| abbrev%$tk $finThmName : ∀ (G : Type _) [$inst : Magma G], G ⊧ $finLawName ↔ $eqName G := $modelsIffLemma $finLawName))
-- define the actual law over `Nat`
elabCommand (← `(command| abbrev%$tk $lawName : Law.NatMagmaLaw := $tl))
-- compatibility between the law and the original equation
elabCommand (← `(command| abbrev%$tk $thmName : ∀ (G : Type _) [$inst : Magma G], G ⊧ $lawName ↔ $eqName G :=
fun G _ ↦ Iff.trans (Law.satisfies_fin_satisfies_nat G $finLawName).symm ($finThmName G)))
-- register the law
modifyEnv (magmaLawExt.addEntry · (lawName.getId, ← (mkNatMagmaLaw lawName.getId).run
{ env := (← getEnv), opts := (← getOptions) }))
elabCommand (← `(command| abbrev%$tk $lawName : Law.MagmaLaw Nat := $tl))
Command.liftTermElabM do
let declMods ← elabModifiers mods
-- Create a decl named `declName`
Expand Down
6 changes: 0 additions & 6 deletions equational_theories/FreeMagma.lean
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,4 @@ theorem evalInMagma_comp {α β} {G} [Magma G] (f : α → β) (g : β → G) :
intro x
induction x <;> simp [fmapFreeMagma, evalInMagma, *]

lemma Fin0_impossible (x : FreeMagma (Fin 0)) : False := by
induction x
case Leaf l =>
cases l; contradiction
case Fork => assumption

end FreeMagma
Empty file modified equational_theories/Generated/All4x4Tables/src/check_correct.py
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified equational_theories/Generated/All4x4Tables/src/dump_tables.py
100755 → 100644
Empty file.
Empty file.
Empty file modified equational_theories/Generated/All4x4Tables/src/generate_lean.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/All4x4Tables/src/prune.py
100755 → 100644
Empty file.
Empty file.
Empty file modified equational_theories/Generated/FinSearch/src/finite_magma.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/FinSearch/src/finsearch.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/FinSearch/src/generate_lean.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/FinSearch/src/parser.py
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified equational_theories/Generated/FinitePoly/src/utils.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/LinearOps/src/check_correct.py
100755 → 100644
Empty file.
Empty file modified equational_theories/Generated/LinearOps/src/write_equations.py
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified equational_theories/Generated/SimpleRewrites/src/utils.py
100755 → 100644
Empty file.
Empty file.
Loading

0 comments on commit f0eabb9

Please sign in to comment.