Skip to content

Instantly share code, notes, and snippets.

View JoJoDeveloping's full-sized avatar
💭
🦉

Johannes Hostert JoJoDeveloping

💭
🦉
View GitHub Profile
From Coq Require Import Nat List Extraction.
Import ListNotations.
Definition EqDec (A:Type) := forall (a b : A), {a = b} + {a <> b}.
Existing Class EqDec.
Definition eq_dec {A : Type} `{EqDec A} : EqDec A := _.
(* Defining these is somewhat annoying since you need to prove their correctness at the same time. *)
Program Instance eq_dec_option {A} {H : EqDec A} : EqDec (option A) := fun a b => match a, b with
None, None => left _
@JoJoDeveloping
JoJoDeveloping / cmra_restrictions.v
Last active November 28, 2024 00:53
Union of non-empty things is non-empty.
From iris.algebra Require Export ofe monoid cmra.
From iris.prelude Require Import options.
Locate pmap_omap.
Section restrict_validity.
Definition restrictV (A : Type) (P : nat → A → Prop) := A.
Local Instance restrictV_validN A P : ValidN (restrictV A P) := P.
Local Instance restrictV_valid A P : Valid (restrictV A P) := λ a, ∀ n, P n a.
Definition restrictV_cmra {A : cmra} PvalidN
(* the new validity restricts the old one *)
@JoJoDeveloping
JoJoDeveloping / file.v
Created October 15, 2024 15:33
Typeclass Inference Error
From iris.prelude Require Import prelude.
From stdpp Require Import option fin_maps fin_map_dom fin_sets.
From stdpp Require Import strings pmap gmap.
From iris.prelude Require Import options.
Definition address := list nat.
Unset Elimination Schemes.
Inductive tree {X:Type} := Node { data : X; children : gmap nat tree }.
Set Elimination Schemes.
@JoJoDeveloping
JoJoDeveloping / bin.rs
Last active August 23, 2024 21:33
Comparison of TB with and without a tree-compacting GC
// adapted from tiny_skia, see https://github.com/RazrFalcon/tiny-skia/blob/master/src/pixmap.rs#L121
extern "Rust" {
pub fn miri_get_alloc_id(ptr: *const ()) -> u64;
pub fn miri_print_borrow_state(alloc_id: u64, show_unnamed: bool);
pub fn miri_pointer_name(ptr: *const (), nth_parent: u8, name: &[u8]);
pub fn miri_run_provenance_gc();
}
pub fn gc() {
unsafe { miri_run_provenance_gc() }
@JoJoDeveloping
JoJoDeveloping / Recursion.v
Last active November 22, 2023 02:48 — forked from Agnishom/Attempt1.v
Convoy Pattern + Sigma Types + Equations
Require Import Coq.Lists.List.
Require Import Coq.Relations.Relation_Operators.
Require Import Coq.Wellfounded.Lexicographic_Product.
Require Import Coq.Arith.Wf_nat.
Require Import Arith.
Import ListNotations.
Require Import Coq.Init.Nat.
Require Import Lia.
@JoJoDeveloping
JoJoDeveloping / UIP_extends.v
Last active June 21, 2023 00:19
A proof that UIP X implies UIP (list X)
From Coq Require Import Arith Lia List.
Definition UIP (T:Type) := forall (x y:T) (H1 H2 : x = y), H1 = H2.
Definition sigma {X:Type} {x y : X} (H : x=y) : y=x := match H in (_=z) return z=x with eq_refl _ => eq_refl end.
Definition tau {X:Type} {x y z: X} (H1 : x=y) : y=z -> x=z := match H1 in (_=w) return w=z->x=z with eq_refl _ => fun H => H end.
(* A hedberg function yields a constant path if both arguments are equal
(i.e. the output path does not depend on the input path)
Usually these are constructed using an equalitiy decider.
@JoJoDeveloping
JoJoDeveloping / ra_eqdec.v
Created November 9, 2022 09:49
Equality-Deciding and enumerating mu-recursive functions.
Require Import Arith Lia List Bool Eqdep_dec EqdepFacts.
From Undecidability.Shared.Libs.DLW
Require Import utils_tac utils_nat utils_list finite pos vec.
From Undecidability.Synthetic Require Import Definitions DecidabilityFacts EnumerabilityFacts ListEnumerabilityFacts ReducibilityFacts.
From Undecidability Require Import Shared.ListAutomation Shared.Dec.
From Undecidability Require Import Shared.Libs.PSL.Vectors.Vectors.
Import ListAutomationNotations.
Require Import Undecidability.MuRec.recalg.
@JoJoDeveloping
JoJoDeveloping / generated.v
Last active February 2, 2022 21:34
Unique generator ghost state
From iris.base_logic Require Import invariants.
From iris.base_logic.lib Require Import mono_nat.
From iris.heap_lang Require Import lang primitive_laws notation.
From iris.prelude Require Import options.
From iris.proofmode Require Import tactics.
(* You might need to uncomment resource_algebras in your _CoqMakefile *)
From semantics.axiomatic Require Import invariant_lib ghost_state_lib hoare_lib ra_lib ipm resource_algebras.
From semantics.axiomatic.heap_lang Require Import adequacy proofmode primitive_laws.
From semantics.axiomatic.program_logic Require Import notation.
This file has been truncated, but you can view the full file.
INFO: JVM info: Oracle Corporation - 1.8.0_242 - 25.242-b08
INFO: Adding File to context from classpath: /mnt/workfs/johannes/Minecraft/Forge/114/MCPConfig/build/libraries/net/minecraftforge/forgeflower/1.5.380.45/forgeflower-1.5.380.45.jar
INFO: Adding Archive: /mnt/workfs/johannes/Minecraft/Forge/114/MCPConfig/build/libraries/net/minecraftforge/forgeflower/1.5.380.45/forgeflower-1.5.380.45.jar
INFO: Loading Class: org/jetbrains/java/decompiler/struct/IDecompiledData.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/StructMember.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchEngine.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchNode.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchEngine$1.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchNode$RuleValue.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/IMatchable$MatchProperties.class
This file has been truncated, but you can view the full file.
INFO: JVM info: Oracle Corporation - 1.8.0_242 - 25.242-b08
INFO: Adding File to context from classpath: /mnt/workfs/johannes/Minecraft/Forge/114/MCPConfig/build/libraries/net/minecraftforge/forgeflower/1.5.380.45/forgeflower-1.5.380.45.jar
INFO: Adding Archive: /mnt/workfs/johannes/Minecraft/Forge/114/MCPConfig/build/libraries/net/minecraftforge/forgeflower/1.5.380.45/forgeflower-1.5.380.45.jar
INFO: Loading Class: org/jetbrains/java/decompiler/struct/IDecompiledData.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/StructMember.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchEngine.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchNode.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchEngine$1.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/MatchNode$RuleValue.class
INFO: Loading Class: org/jetbrains/java/decompiler/struct/match/IMatchable$MatchProperties.class